Page not loading? Try clicking here.
Placeholder

#8578

Peers 2s 1024MB

Problems

The ages of N people are given as integers in the range 1 to 109.

When two people are similar in age, we call them "peers."

That is, we want to see the case where the difference is smallest.

Compute and print the minimum age difference between selected two people.


Input

N is entered on the first line. (2 ≤ N ≤ 200,000)

At the next line, the ages of N people are entered. (Refer to the text for the range)

(People of the same age may be entered. In this case, the answer will be 0.)


Output

Print the minimum age difference between two people.


Example

7
60 2 19 39 100 50 89
10

Two people whose age are 50 and 60 have the smallest difference at 10.



Source

againalgo

You must sign in to write code.