cho.sh
Notes
Loading...

Closest Pair of Points

Time limit

1s

Memory limit

256 MB

Problem

Given n points on a two-dimensional plane, write a program that finds the squared distance between the closest pair of points.

Input

The first line contains a natural number n (2 <= n <= 100,000). Each of the next n lines contains the x and y coordinates of one point. Every coordinate is an integer whose absolute value is at most 10,000. Multiple points may have exactly the same coordinates.

Output

Print the squared distance between the closest pair of points.