#include <bits/stdc++.h>
using namespace std;
inline int read() {
int x=0,f=1;char ch=getchar();
while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
return x*f;
}
constexpr int N = 4e5 + 10;
int n;
long long ans = LLONG_MAX;
struct node {
long long x, y;
long long sum;
}a[N];
inline bool cmp(node x, node y) {
return x.sum < y.sum;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
n = read();
for(int i = 1; i <= n; i++) a[i].x = read(), a[i].y = read(), a[i].sum = a[i].x * a[i].y;
sort(a + 1, a + 1 + n, cmp);
for(int i =1; i <= n; i++) {
for(int j = 1; j <= 50 && i + j <= n; j++) {
ans = min(ans, (a[i].x - a[i + j].x) * (a[i].x - a[i + j].x) + (a[i].y - a[i + j].y) * (a[i].y - a[i + j].y));
}
}
cout << ans;
return 0;
}