~/algor $ cat problems/saralash-eng-yaqin-juftlik
Two closest numbers
Medium
1000 ms
128 MB
45%
$n$ integers $a_{1}, a_{2}, \dots, a_{n}$ are given. Choose two numbers at different positions ($i \ne j$) so that the absolute value of their difference $|a_{i} - a_{j}|$ is as small as possible. Find this smallest value.
Input
The first line contains a positive integer $n$. The second line contains $n$ integers $a_{i}$ separated by spaces.
Output
One integer — the smallest $|a_{i} - a_{j}|$.
Note
$2 \le n \le 2 * 10^{5}$
$-10^{9} \le a_{i} \le 10^{9}$
Examples
Input #1
5 15 3 9 22 11
Output #1
2
Input #2
2 -4 6
Output #2
10