#include <bits/stdc++.h>
using namespace std;
#define X first
#define Y second
double calculDist(pair<int, int> a, pair<int, int> b)
{
double x = a.X - b.X;
double y = a.Y - b.Y;
return sqrt(pow(x,2) + pow(y,2));
}
bool cmpY(const pair<int,int>& a, const pair<int,int> &b)
{
return a.Y < b.Y;
}
bool cmpX(const pair<int,int>& a, const pair<int, int> &b)
{
return a.X < b.X;
}
double DI(int st, int dr, vector<pair<int,int>> &pY,vector<pair<int,int>> &P)
{
if(dr - st == 1)
return INT_MAX;
else if(dr - st == 2)
{
if(pY[st].Y > pY[st+1].Y)
swap(pY[st], pY[st+1]);
return calculDist(P[0],P[1]);
}
int m = (st + dr)/2,i,j;
double dist = min(DI(st,m,pY,P),DI(m,dr,pY,P));
int delta = (int)(ceil(sqrt(dist)));
vector<pair<int,int>> verif(dr - st);
merge(pY.begin() + st, pY.begin() + m, pY.begin() + m, pY.begin() + dr, verif.begin(), cmpY);
copy(verif.begin(), verif.begin() + (dr - st), pY.begin() + st);
vector<pair<int,int>> z;
for(unsigned i = st; i < dr; i++)
if(abs(pY[i].X - P[m].X) <= dist)
z.push_back(pY[i]);
///sort(verif.begin(),verif.end(),cmp);
for(unsigned i = 0; i < z.size(); i++)
for(unsigned j = i+1;j< z.size() && z[j].Y - z[i].Y <= dist; j++)
dist = min(dist, calculDist(z[i],z[j]));
return dist;
}
int main()
{
int n;
vector<pair<int,int>>P;
ifstream fin("cmap.in");
ofstream fout("cmap.out");
int x,y,i;
fin>>n;
for(i = 0; i < n; i++)
{
fin>>x>>y;
P.push_back(make_pair(x,y));
}
sort(P.begin(),P.end(),cmpX);
vector<pair <int,int>> pY = P;
fout<<fixed<<setprecision(6)<<(DI(0,n-1,pY,P));
fin.close();
fout.close();
return 0;
}