#include <bits/stdc++.h>
#define int long long
#define PII pair<int,int>
using namespace std;
const int N = 400010;
int n;
pair<int, int> a[N];
bool cmp(PII a,PII b) {
if(a.first*a.second==b.first*b.second) {
if(a.first==b.first){
return a.second>b.second;
}
return a.first>b.first;
}
return a.first*a.second<b.first*b.second;
}
inline int dist(int i, int j) {
return (a[i].first - a[j].first) * (a[i].first - a[j].first) +
(a[i].second - a[j].second) * (a[i].second - a[j].second);
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(0);cout.tie(0);
cin >> n;
for (int i = 1;i <= n;++i) {
cin >> a[i].first>>a[i].second;
}
sort(a + 1, a + n + 1,cmp);
int MinDist = LLONG_MAX;
for (int i = 1;i <= n;++i) {
for (int j = 1;j <= 680 && i + j <= n;++j) {
MinDist = min(MinDist, dist(i, j+i));
}
}
cout<<MinDist<<"\n";
return 0;
}