#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#define min(p,q)((p)<(q)?(p):(q))
#define zahyoutype double
typedef struct Point{zahyoutype x,y;}P;
int jisho(const void*p,const void*q){
	P *pp=(P*)p,*qq=(P*)q;
	if(pp->y<qq->y)return -1;
	if(pp->y>qq->y)return  1;
	return pp->x>qq->x;
}
double distPP(P p,P q){return hypot(p.x-q.x,p.y-q.y);}
void readpoint(P*p){zahyoutype x=1;scanf(x/2?"%lf%lf":"%ld%ld",&p->x,&p->y);}
void printpoint(P p){zahyoutype x=1;printf(x/2?"%.9lf %.9lf\n":"%ld %ld\n",p.x,p.y);}

P p[100010];
int main(){
	int n;
	scanf("%d",&n);
	double r=rand();
	for(int i=0;i<n;i++){
		P t;
		readpoint(&t);
		p[i].x=t.x*cos(r)-t.y*sin(r);
		p[i].y=t.x*sin(r)+t.y*cos(r);
	}
	qsort(p,n,sizeof(P),jisho);
	double ans=1e10;
	for(int i=0;i<n;i++){
		for(int j=i+1;j<n&&p[j].y-p[i].y<ans;j++){
			ans=min(ans,distPP(p[i],p[j]));
		}
	}
	printf("%.9f\n",ans);
}
