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 <algorithm>
# include <cmath>
# include <cstdio>
# include <iostream>
# include <vector>
using namespace std;

static const double eps = 1e-10;

int N;

bool eq(double a, double b) {return fabs(a - b) < eps;}
struct Point 
{
	double x, y;
};
Point operator -(Point a, Point b){return (Point) {a.x - b.x, a.y - b.y};}
int compx(const Point & a, const Point & b) {return eq(a.x, b.x) ? a.y < b.y : a.x < b.x;}
int compy(const Point & a, const Point & b) {return eq(a.y, b.y) ? a.x < b.x : a.y < b.y;}
double norm(Point a) {return a.x * a.x + a.y * a.y;}
double abs(Point a) {return sqrt(norm(a));}
Point p[100050];

double ClosestPair(Point * p, int n)
{
	if(n <= 1) return 1e9;
	int m = n / 2;
	double tx = p[m].x;
	double d = min(ClosestPair(p, m), ClosestPair(p + m, n - m));
	inplace_merge(p, p + m, p + n, compy);
	vector<Point> q;
	for(int i = 0; i < n; i++)
	{
		if(fabs(tx - p[i].x) >= d) continue;
		for(int j = q.size() - 1; ~ j; j--)
		{
			Point v = p[i] - q[j];
			if(v.y >= d) break;
			d = min(d, abs(v));
		}
		q.push_back(p[i]);
	}
	return d;
}

int main()
{
	scanf("%d", & N);
	for(int i = 0; i < N; i++) scanf("%lf%lf", & p[i].x, & p[i].y);
	sort(p, p + N, compx);
	printf("%.11lf\n", ClosestPair(p, N));
	return 0;
}
