#0005E4

Menhetn

You are given a set of points {(x1, y1), (x2, y2), ..., (xn, yn)}. You should compute the smallest menhetn distance between all the pairs of the points.
Menhetn distance between two points (a, b) and ([], d) is defined as |a - c| + |b - d|.



InputIn the first line of the standard input is given an integer n (2 <= n <= 1000). In the next n lines are given the points -- in the i-th is given the point (xi, yi) (-100000 <= xi, yi <= 100000), where both xi and yi are integers.

OutputIn the first and the only line of the standard output you should print the smallest distance.

Input:
[c]5
1 2
4 2
8 3
9 5
15 11

Output:
3
Explanation:
The distance between the first and the second point is 3 (|1 - 4| + |2 - 2| = 3), as well as the distance between the third and the forth point (|8 - 9| + |3 - 5| = 3).

Input:
2
-1 1
-1 1

Output:
0

Submit solution

Coming later

The grading service will be connected in a later migration step. You can inspect the task and your previous results now.