#C10250. Minimize Energy Gap

    ID: 39435 Type: Default 1000ms 256MiB

Minimize Energy Gap

Minimize Energy Gap

You are given n robots each with an integer energy level. Your task is to determine the minimum gap (difference) between any two robots in the optimal arrangement. In other words, after sorting the energy levels in non-decreasing order, you need to compute the minimal difference between successive energy levels.

If there is only one robot, the gap is defined as 0.

This problem tests your ability in sorting and simple iteration.

Note: All formulas are expressed in \(\LaTeX\). For instance, the gap between two consecutive energy levels \(E_i\) and \(E_{i+1}\) is given by \(E_{i+1} - E_i\).

inputFormat

The input is read from stdin and consists of two lines:

  1. The first line contains an integer \(n\) \( (1 \leq n \leq 10^5)\) representing the number of robots.
  2. The second line contains \(n\) space-separated integers representing the energy levels of the robots.

outputFormat

Output a single integer to stdout which is the minimum gap between any two consecutive energy levels after sorting them in non-decreasing order.

## sample
1
7
0