#include<iostream> #include<cstdio> #include<algorithm> #define MAX_N 50000 usingnamespace std; template <classT> inlinevoidread(T &x){ x = 0; int c = getchar(), f = 1; for (; !isdigit(c); c = getchar()) if (c == 45) f = -1; for (; isdigit(c); c = getchar()) (x *= 10) += f*(c-'0'); } int n, m; structpnt { int x, y; intoperator * (const pnt &t) const {return x*t.y-y*t.x;} pnt operator - (const pnt &t) const {return (pnt){x-t.x, y-t.y};} booloperator < (const pnt &t) const {return x == t.x ? y < t.y : x < t.x;} } p[MAX_N+5], c[MAX_N+5]; intsqr(int x){return x*x;} intdis(pnt a, pnt b){returnsqr(a.x-b.x)+sqr(a.y-b.y);} voidConvexHull(){ sort(p+1, p+n+1), c[++m] = p[1], c[++m] = p[2]; for (int i = 3; i <= n; c[++m] = p[i++]) while (m > 1 && (p[i]-c[m-1])*(c[m]-c[m-1]) >= 0) m--; int t = m; c[++m] = p[n-1]; for (int i = n-2; i; c[++m] = p[i--]) while (m > t && (p[i]-c[m-1])*(c[m]-c[m-1]) >= 0) m--; m--; } intRotatingCalipers(){ if (m == 2) returndis(c[1], c[2]); int a = 1, b = 1; for (int i = 1; i <= m; i++) if (c[i] < c[a]) a = i; for (int i = 1; i <= m; i++) if (c[b] < c[i]) b = i; int ret = dis(c[a], c[b]); for (int sa = a, sb = b; a^sb || b^sa; ret = max(ret, dis(c[a], c[b]))) (c[a%m+1]-c[a])*(c[b%m+1]-c[b]) <= 0 ? a = a%m+1 : b = b%m+1; return ret; } intmain(){ read(n); for (int i = 1; i <= n; i++) read(p[i].x), read(p[i].y); returnConvexHull(), printf("%d", RotatingCalipers()), 0; }