#K56802. Minimize Adjacent Gap

    ID: 30279 Type: Default 1000ms 256MiB

Minimize Adjacent Gap

Minimize Adjacent Gap

You are given a list of integers representing the heights of blocks. Your task is to compute the minimum difference between any two adjacent blocks after sorting the blocks in non-decreasing order. In other words, if the sorted order is \(a_1, a_2, \ldots, a_n\), you must find the minimum value of \(a_i - a_{i-1}\) for \(2 \le i \le n\). If the number of blocks is less than 2, output 0.

Input Format: The input is given from standard input. The first line contains an integer \(n\) (\(0 \le n \le 10^5\)) representing the number of blocks. The next line contains \(n\) space-separated integers representing the heights of the blocks.

Output Format: Output a single integer, which is the minimum difference between any two adjacent block heights in the sorted order. If \(n < 2\), output 0.

Example:

Input:
5
4 7 9 3 2

Output: 1

</p>

inputFormat

The first line contains a single integer \(n\), the number of blocks. The second line contains \(n\) space-separated integers representing the heights of the blocks.

outputFormat

Print a single integer denoting the minimum difference between any two adjacent blocks after sorting. If there are fewer than 2 blocks, output 0.

## sample
5
4 7 9 3 2
1

</p>