#include <cmath>
#include <cstdio>
#include <vector>
#include <cstdlib>
#include <iomanip>
#include <iostream>
#include <algorithm>
using namespace std;
typedef pair<int, int> pr;
typedef long long int llu;
inline llu min(const llu& x, const llu& y) {return x <= y ? x : y;}
inline bool compX(const pr& x, const pr& y) {return x.first < y.first || (x.first == y.first && x.second < y.second);}
inline bool compY(const pr& x, const pr& y) {return x.second < y.second || (x.second == y.second && x.first < y.first);}
inline llu dSquare(const pr& x, const pr& y) {return 1LL * (x.first - y.first) * (x.first - y.first) + 1LL * (x.second - y.second) * (x.second - y.second);}
llu closestPair(vector<pr>& vx, vector<pr>& vy, vector<pr>& aux, int left, int right)
{
llu minDSquare;
if(left >= right) return -1;
if(right - left <= 9)
{
minDSquare = dSquare(vx[left], vx[left + 1]);
for(int i = left; i < right; ++i)
{
for(int j = i + 1; j <= right; ++j)
{
minDSquare = min(minDSquare, dSquare(vx[i], vx[j]));
}
}
}
else {
int i, j, k, middle;
middle = (left + right) >> 1;
minDSquare = min(closestPair(vx, vy, aux, left, middle), closestPair(vx, vy, aux, middle + 1, right));
for(k = 0, i = left; i <= right; ++i)
{
if(vx[middle].first - vy[i].first <= minDSquare)
{
aux[k++] = vy[i];
}
}
for(i = 0, k -= 1; i < k; ++i)
{
for(j = i + 1; j <= k && j - i < 8; ++j)
{
minDSquare = min(dSquare(aux[i], aux[j]), minDSquare);
}
}
}
return minDSquare;
}
inline double closestPair(vector<pr>& v)
{
vector<pr> vx(v), vy(v), aux;
// vector<pr>::iterator iendX, iendY;
sort(vx.begin(), vx.end(), compX);
sort(vy.begin(), vy.end(), compY);
/* iendX = unique(vx.begin(), vx.end());
iendY = unique(vy.begin(), vy.begin());
vx.resize(distance(vx.begin(), iendX));
vy.resize(distance(vy.begin(), iendY));
*/
aux.resize(vx.size());
return sqrt(1.0 * closestPair(vx, vy, aux, 0, vx.size() - 1));
}
int main()
{
pr x;
int N;
vector<pr> v;
freopen("cmap.in", "rt", stdin);
freopen("cmap.out", "wt", stdout);
for(cin >> N; N; --N)
{
cin >> x.first >> x.second;
v.push_back(x);
}
cout << fixed << setprecision(6) << closestPair(v) << '\n';
return EXIT_SUCCESS;
}