#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <limits>
#include <iomanip>
#define N_MAX 100005
using namespace std;
ifstream in("cmap.in");
ofstream out("cmap.out");
struct point {
int x, y;
};
bool sort_after_x (point a, point b){
return a.x < b.x;
}
bool sort_after_y (point a, point b){
return a.y < b.y;
}
float get_distance (point a, point b){
return sqrt((a.x-b.x) * (a.x-b.x) + (a.y-b.y) * (a.y-b.y));
}
float brute_force (vector <point> p, int numPoints){
float rez = __FLT_MAX__;
for (int i=0; i<numPoints; ++i)
for (int j=i+1; j<numPoints; ++j)
rez = min(rez, get_distance(p[i], p[j]));
return rez;
}
vector <point> get_subvector (vector<point> p, int x, int y){
vector <point> v;
for (int i=x; i<y; ++i)
v.push_back(p[i]);
return v;
}
vector <point> get_strip (vector <point> p, int mid, int numPoints, int d){
vector <point> v;
v.push_back(p[mid]);
for (int i=mid+1; i<numPoints; ++i){
if (p[i].x - p[mid].x <= d)
v.push_back(p[i]);
else break;
}
for (int i=mid-1; i>=0; --i){
if (p[mid].x - p[i].x <= d)
v.push_back(p[i]);
else break;
}
return v;
}
float divide_et_impera (vector <point> p, int numPoints){
if (numPoints <= 3)
return brute_force(p, numPoints);
int mid = numPoints / 2;
vector <point> firstHalf = get_subvector (p, 1, mid);
vector <point> secondHalf = get_subvector(p, mid, numPoints);
float d1 = divide_et_impera(firstHalf, firstHalf.size());
float d2 = divide_et_impera(secondHalf, secondHalf.size());
float d = min(d1, d2);
vector <point> strip = get_strip(p, mid, numPoints, d);
sort (strip.begin(), strip.end(), sort_after_y);
numPoints = strip.size();
for (int i=0; i<numPoints-1; ++i){
for (int j=1; j<=7 && i+j < numPoints; ++j){
d = min(d, get_distance(strip[i], strip[i+j]));
}
}
return d;
}
int main (){
vector <point> points;
int n;
in >> n;
int x, y;
for (int i=1; i<=n; ++i){
in >> x >> y;
points.push_back({x, y});
}
sort (points.begin(), points.end(), sort_after_x);
out << fixed << setprecision(6);
out << divide_et_impera(points, points.size());
return 0;
}