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 <bits/stdc++.h>

using namespace std;

typedef long long int64;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef complex<double> point;
typedef vector<point> polygon;

const double oo = 1e18;
const double eps = 1e-9;

namespace std
{
	bool operator<(point a, point b)
	{
		if (a.real() != b.real())
			return a.real() < b.real();
		return a.imag() < b.imag();
	}
}

double closestPairPoints(vector<point> &p){
	auto cmp = [](point a, point b)
	{
		return make_pair(a.imag(), a.real()) < make_pair(b.imag(), b.real());
	};

	int n = (int)p.size();
	sort(p.begin(), p.end());

	set<point, decltype(cmp)> S(cmp);
	double ans = oo;
	int ptr = 0;

	for (int i = 0; i < n; ++i)
	{
		while (ptr < i && abs(p[i].real() - p[ptr].real()) >= ans)
			S.erase(p[ptr++]);

		auto lo = S.lower_bound(point(-oo, p[i].imag() - ans - eps));
		auto hi = S.upper_bound(point(-oo, p[i].imag() + ans + eps));

		for (decltype(lo) it = lo; it != hi; ++it)
			ans = min(ans, abs(p[i] - *it));

		S.insert(p[i]);
	}

	return ans;
}

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);

	int n; cin >> n;
	vector<point> p(n);
	
	for (int i = 0; i < n; ++i){
		double x, y; cin >> x >> y;
		p[i] = point(x, y);
	}

	cout.precision(10);
	cout << fixed << closestPairPoints(p) << endl;

	return 0;
}