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>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,a,b) for(int i=a;i>=b;i--)
#define fore(i,a) for(auto &i:a)
#define all(x) (x).begin(),(x).end()
#pragma GCC optimize ("-O3")
using namespace std; void _main(); int main() { cin.tie(0); ios::sync_with_stdio(false); _main(); }
typedef long long ll; const int inf = INT_MAX / 2; const ll infl = 1LL << 60;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
//---------------------------------------------------------------------------------------------------
/*---------------------------------------------------------------------------------------------------
　　　　　　　　　　　 ∧＿∧  
　　　　　 ∧＿∧ 　（´<_｀ ）　 Welcome to My Coding Space!
　　　　 （ ´_ゝ`）　/　 ⌒i     
　　　　／　　　＼　 　  |　|     
　　　 /　　 /￣￣￣￣/　　|  
　 ＿_(__ﾆつ/　    ＿/ .| .|＿＿＿＿  
　 　　　＼/＿＿＿＿/　（u　⊃  
---------------------------------------------------------------------------------------------------*/



// Tはintのほうがdoubleより早い
// ！！！注意！！！！　　　　　得られるのは最近点対の距離の二乗！！！！！！！！！！！！！！
#define INF inf
using T = double;
struct ClosestPair{
    vector<pair<T,T>> a, b, c;

    void add(T x, T y) { a.push_back({ x, y }); }
    inline T sqr(T x) { return x * x; }
    T dis(pair<T,T>& a, pair<T,T>& b) { return sqr(a.first - b.first) + sqr(a.second - b.second); }

    T calc(int l, int r)
    {
        if (l == r) return INF;
        int mid = (l + r) >> 1;
        T d = min(calc(l, mid), calc(mid + 1, r));
        double d0 = sqrt(double(d));
        int cnt1 = 0, cnt2 = 0;
        T ma = a[l].first, mi = a[r].first;
        for (int i = l; i <= mid; i++) ma = max(a[i].first, ma);
        for (int i = mid + 1; i <= r; i++) mi = min(a[i].first, mi);
        for (int i = l; i <= mid; i++) if (a[i].first>mi - d0) b[++cnt1] = a[i];
        for (int i = mid + 1; i <= r; i++) if (a[i].first<ma + d0) c[++cnt2] = a[i];
        int k = 1;
        for (int i = 1; i <= cnt1; i++)
        {
            while (k <= cnt2 && c[k].second<b[i].second - d0) k++;
            for (int j = k; j <= cnt2 && c[j].second<b[i].second + d0; j++) d = min(d, dis(b[i], c[j]));
        }
        int k1 = l, k2 = mid + 1;
        for (int i = l; i <= r; i++)
            if (k1 <= mid && (k2>r || a[k1].second<a[k2].second)) b[i] = a[k1++]; else b[i] = a[k2++];
        for (int i = l; i <= r; i++) a[i] = b[i];
        return d;
    }

    T solve() {
        int n = a.size();
        assert(2 <= n);
        sort(all(a));
        b.resize(n);
        c.resize(n);
        return calc(0, n - 1);
    }
};
//---------------------------------------------------------------------------------------------------





int N;
ClosestPair cp;
//---------------------------------------------------------------------------------------------------
void _main() {
    cin >> N;
    rep(i, 0, N) {
        double x, y; cin >> x >> y;
        cp.add(x, y);
    }
    double ans = sqrt(cp.solve());
    printf("%.10f\n", ans);

}
