#include using namespace std; struct Point { Point(int x, int y) : x(x), y(y) {} int x, y; bool checked = false; }; bool cmpHoriz(const Point *a, const Point *b) { if (a->x == b->x) return a->y > b->y; return a->x > b->y; } bool cmpVert(const Point *a, const Point *b) { if (a->y == b->y) return a->x > b->x; return a->y > b->y; } double dist(Point *a, Point *b) { return sqrt(pow(a->x - b->x, 2) + pow(a->y - b->y, 2)); } int main() { int N; cin >> N; vector horizontal; vector vertical; for (int i = 0; i < N; ++i) { int x, y; cin >> x >> y; Point *p = new Point(x, y); horizontal.push_back(p); vertical.push_back(p); } std::sort(horizontal.begin(), horizontal.end(), cmpHoriz); std::sort(vertical.begin(), vertical.end(), cmpVert); int left = 0, right = N - 1, bottom = 0, top = N - 1; int count = N; while (count != 4) { while (horizontal[left]->checked) left++; while (horizontal[right]->checked) right--; if (horizontal[left]->x == horizontal[right]->x) { horizontal[left]->checked = true; left++; horizontal[right]->checked = true; right--; while (horizontal[left]->checked && left < N) left++; while (horizontal[right]->checked && right >= 0) right--; horizontal[left]->checked = true; left++; horizontal[right]->checked = true; right--; count -= 4; continue; } horizontal[left]->checked = true; left++; horizontal[right]->checked = true; right--; while (vertical[bottom]->checked && bottom < N) bottom++; while (vertical[top]->checked && top >= 0) top--; vertical[bottom]->checked = true; bottom++; vertical[top]->checked = true; top--; count -= 4; } vector points; for (int i = left; i <= right; ++i) { if (!horizontal[i]->checked) points.push_back(horizontal[i]); } int res = dist(points[0], points[1]) * dist(points[3], points[1]); cout << res; for (int i = 0; i < N; ++i) { delete horizontal[i]; } return 0; }