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>
#include <cmath>

using namespace std;
typedef long long ll;
//typedef unsigned long long ll;

#define rep(i, n) for (int i = 0; i < (n); ++i)
//#define rep(i, n) for (ll i = 0; i < (n); ++i)
//#define sz(x) ll(x.size())
//typedef pair<ll, int> P;
//typedef pair<ll, ll> P;
//const double INF = 1e10;
//const ll INF = LONG_LONG_MAX / 100;
//const ll INF = (1ll << 31) - 1;
//const ll INF = 1e15;
const ll MINF = LONG_LONG_MIN;
//const int INF = INT_MAX / 10;
#define cmin(x, y) x = min(x, y)
#define cmax(x, y) x = max(x, y)
//typedef pair<int, int> P;
//typedef pair<double, double> P;

//bool contain(set<P> &s, P a) { return s.find(a) != s.end(); }

//ifstream myfile("C:\\Users\\riku\\Downloads\\0_00.txt");
//ofstream outfile("log.txt");
//outfile << setw(6) << setfill('0') << prefecture << setw(6) << setfill('0') << rank << endl;
// std::cout << std::bitset<8>(9);
const int mod = 1000000007;
typedef priority_queue<long long, vector<long long>, greater<long long>> PQ_ASK;


void print_line(vector<string> &line) {
    if (line.size() == 0ll) {
        cout << endl;
        return;
    }
    for (ll i = 0; i < line.size(); i++) {
        cout << line[i];
        if (i == line.size() - 1) cout << endl;
        else cout << ' ';
    }
}

#define EPS (1e-10)
#define equals(a, b) (fabs((a) - (b)) < EPS)

struct Point {
    double x, y;

    Point(double x = 0, double y = 0) : x(x), y(y) {}

    Point operator+(Point p) { return Point(x + p.x, y + p.y); }

    Point operator-(Point p) { return Point(x - p.x, y - p.y); }

    Point operator*(double a) { return Point(a * x, a * y); }

    Point operator/(double a) { return Point(x / a, y / a); }

    double abs() { return sqrt(norm()); }

    double norm() { return x * x + y * y; }

    bool operator<(const Point &p) const {
        return x != p.x ? x < p.x : y < p.y;
    }

    bool operator==(const Point &p) const {
        return fabs(x - p.x) < EPS && fabs(y - p.y) < EPS;
    }
};

typedef Point Vector;
typedef vector<Point> Polygon;


static const int IN = 2;
static const int ON = 1;
static const int OUT = 0;

double dot(Vector a, Vector b) {
    return a.x * b.x + a.y * b.y;
}

double cross(Vector a, Vector b) {
    return a.x * b.y - a.y * b.x;
}

static const int COUNTER_CLOCKWISE = 1;
static const int CLOCKWISE = -1;
static const int ONLINE_BACK = 2;   // p2->p0->p1
static const int ONLINE_FRONT = -2; // p0->p1->p2
static const int ON_SEGMENT = 0;    // p0->p2->p1

double norm(Point a) {
    return a.x * a.x + a.y * a.y;
}

int ccw(Point p0, Point p1, Point p2) {
    Vector a = p1 - p0;
    Vector b = p2 - p0;
    if (cross(a, b) > EPS) return COUNTER_CLOCKWISE;
    if (cross(a, b) < -EPS) return CLOCKWISE;
    if (dot(a, b) < -EPS) return ONLINE_BACK;
    if (norm(a) < norm(b)) return ONLINE_FRONT;
    return ON_SEGMENT;
}

Polygon f(Polygon g) {
    Polygon u, l;
    if (g.size() < 3) return g;
    sort(g.begin(), g.end());
    u.push_back(g[0]);
    u.push_back(g[1]);
    l.push_back(g[g.size() - 1]);
    l.push_back(g[g.size() - 2]);

    // upper
    for (int i = 2; i < g.size(); i++) {
        for (int n = u.size(); n >= 2 && ccw(u[n - 2], u[n - 1], g[i]) == COUNTER_CLOCKWISE; n--) {
            u.pop_back();
        }
        u.push_back(g[i]);
    }

    // lower
    for (int i = g.size() - 3; i >= 0; i--) {
        for (int n = l.size(); n >= 2 && ccw(l[n - 2], l[n - 1], g[i]) == COUNTER_CLOCKWISE; n--) {
            l.pop_back();
        }
        l.push_back(g[i]);
    }

    reverse(l.begin(), l.end());
    for (int i = u.size() - 2; i >= 1; i--) l.push_back(u[i]);

    return l;
}


double abs(Point a) {
    return sqrt(norm(a));
}


double getDistance(Point a, Point b) {
    return abs(a - b);
}


double convexDiameter(Polygon g) {
    double d = 0.0;
    int n = g.size();
    int is = 0, js = 0;
    for (int i = 1; i < n; i++) {
        if (g[i].y > g[is].y) is = i;
        if (g[i].y < g[js].y) js = i;
    }
    d = getDistance(g[is], g[js]);

    int i = is, j = js, maxi = is, maxj = js;
    do {
        if (cross(g[(i + 1) % n] - g[i], g[(j + 1) % n] - g[j]) >= 0.0) j = (j + 1) % n;
        else i = (i + 1) % n;
        if (getDistance(g[i], g[j]) > d) {
            d = getDistance(g[i], g[j]);
            maxi = i, maxj = j;
        }
    } while (i != is || j != js);

    return d;
}

struct Segment {
    Point p1, p2;

    Segment(Point p1, Point p2) : p1(p1), p2(p2) {}
};

typedef Segment Line;

bool isParallel(Vector a, Vector b) {
    return equals(cross(a, b), 0.0);
}

bool isParallel(Point a1, Point a2, Point b1, Point b2) {
    return isParallel(a1 - a2, b1 - b2);
}

bool isParallel(Segment s1, Segment s2) {
    return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0);
}


bool intersect(Point p1, Point p2, Point p3, Point p4) {
    return (ccw(p1, p2, p3) * ccw(p1, p2, p4) <= 0 &&
            ccw(p3, p4, p1) * ccw(p3, p4, p2) <= 0);
}

bool intersect(Segment s1, Segment s2) {
    return intersect(s1.p1, s1.p2, s2.p1, s2.p2);
}


Point getCrossPoint(Segment s1, Segment s2) {
    Vector base = s2.p2 - s2.p1;
    double d1 = abs(cross(base, s1.p1 - s2.p1));
    double d2 = abs(cross(base, s1.p2 - s2.p1));
    double t = d1 / (d1 + d2);
    return s1.p1 + (s1.p2 - s1.p1) * t;
}


Polygon andrewScan(Polygon g) {
    Polygon u, l;
    if (g.size() < 3) return g;
    sort(g.begin(), g.end());
    u.push_back(g[0]);
    u.push_back(g[1]);
    l.push_back(g[g.size() - 1]);
    l.push_back(g[g.size() - 2]);

    // upper
    for (int i = 2; i < g.size(); i++) {
        for (int n = u.size(); n >= 2 && ccw(u[n - 2], u[n - 1], g[i]) != CLOCKWISE; n--) {
            u.pop_back();
        }
        u.push_back(g[i]);
    }

    // lower
    for (int i = g.size() - 3; i >= 0; i--) {
        for (int n = l.size(); n >= 2 && ccw(l[n - 2], l[n - 1], g[i]) != CLOCKWISE; n--) {
            l.pop_back();
        }
        l.push_back(g[i]);
    }

    reverse(l.begin(), l.end());
    for (int i = u.size() - 2; i >= 1; i--) l.push_back(u[i]);

    return l;
}


double area(Polygon g) {
    if (g.size() < 3) return 0;
    int n = g.size();
    Point o(0.0, 0.0);
    double s = 0.0;
    for (int i = 0; i < n; i++) s += cross(g[i] - o, g[(i + 1) % n] - o);
    return abs(s) / 2.0;
}

const double INF = 1e10;

typedef pair<double, double> p;
p v[100000];

bool comp_y(p a, p b) {
    return a.second < b.second;
}

double closest_pair(p *a, int n) {
    if (n <= 1) return INF;

    int m = n / 2;
    double x = a[m].first;
    double d = min(closest_pair(a, m), closest_pair(a + m, n - m)); // x軸で区切られた範囲内での頂点対のみ考慮
    inplace_merge(a, a + m, a + n, comp_y); // ソート済みの[a, a+m)と[a+m, a+n)をy座標基準でマージ

    vector<p> b; // 直線 x = a[m].firstから距離d未満の点を入れる
    for (int i = 0; i < n; i++) {
        if (fabs(a[i].first - x) >= d) continue; // そもそもx座標の差がd以上の点は論外

        // bに入っている頂点を末尾から、y座標の差がd以上になるまで見ていく
        // y座標降順で見ていき、d以上離れた時点で打ち切り
        for (int j = 0; j < b.size(); j++) {
            double dx = a[i].first - b[b.size() - 1 - j].first;
            double dy = a[i].second - b[b.size() - 1 - j].second;
            if (dy >= d) break;
            d = min(d, sqrt(dx * dx + dy * dy));
        }

        b.push_back(a[i]);
    }
    return d;
}


int main() {


    int n;
    cin >> n;
    for (int i = 0; i < n; i++) {
        double x, y;
        cin >> x >> y;
        v[i] = {x, y};
    }
    sort(v, v + n);
    cout << fixed << setprecision(12) << closest_pair(v, n) << endl;
    return 0;
}
