struct P{
int x, y;
bool operator<(const P &o) const{
if (x != o.x){
return x < o.x;
}
return y < o.y;
}
};
int cross(const P &a, const P &b){
return a.x * b.y - b.x * a.y;
}
int cross(const P &o, const P &a, const P &b){
return cross({a.x - o.x, a.y - o.y}, {b.x - o.x, b.y - o.y});
}
int main(){
vector<P> h;
for (int i = 0; i < n; i++){
while (h.size() > 1 && cross(h[h.size()-2],h.back(),a[i])<=0){
h.pop_back();
}
h.push_back(a[i]);
}
}
