For given n points in metric space, find the distance of the closest points.

Constraints

* 2 ≤ n ≤ 100,000
* -100 ≤ x, y ≤ 100

Input


n
x0 y0
x1 y1
:
xn-1 yn-1


The first integer n is the number of points.

In the following n lines, the coordinate of the i-th point is given by two real numbers xi and yi. Each value is a real number with at most 6 digits after the decimal point.

Output

Print the distance in a line. The output values should be in a decimal fraction with an error less than 0.000001.

Examples

Input

2
0.0 0.0
1.0 0.0


Output

1.000000


Input

3
0.0 0.0
2.0 0.0
1.0 1.0


Output

1.41421356237
#include <cmath>
#include <vector>
#include <cstdio>
#include <cstdlib>
#include <algorithm>

using namespace std;
typedef pair<double,double> pp;
vector<pp> a;

#define sqr(x) ((x)*(x))
double Plus (double x){
	return x<0?-x:x;
}
double dist (pp x, pp y){
	return sqr(x.first-y.first) + sqr(x.second-y.second);
}

double go (int l, int r)
{
	if (r-l==1)
		return dist(a[l],a[r]);
	if (r-l==2)
		return min(dist(a[l],a[l+1]), min(dist(a[l],a[l+2]), dist(a[l+1],a[l+2])));

	int m=(l+r)/2;
	double d=min(go(l,m),go(m+1,r));

	vector<pp> v;
	for (auto i=l;i<=r;i++)
		if (sqr(a[i].first-a[m].first)<d)
			v.emplace_back (a[i].second,a[i].first);
	sort (v.begin(),v.end());
	for (auto i=v.begin();i!=v.end();i++)
		for (auto j=i+1;j!=v.end();j++)
		{
if (sqr(j->first - i->first) > d) break;
			d=min(d,dist(*i,*j));
		}
	return d;
}

int main ()
{
	int i,n;
	double x,y;
	scanf ("%d",&n);
	for (i=0;i<n;i++)
		scanf ("%lf%lf",&x,&y), a.emplace_back(x,y);
	sort (a.begin(),a.end());
	printf ("%lf ",sqrt(go(0,n-1)));
}