A theft occurred at a computer equipment store during the night.
Previously, all keyboards sold in the store were assigned sequential numbers, starting from a certain natural number . For instance, if x = 4 and the store sold keyboards, they would be numbered , , . Similarly, if x = 10 and keyboards were sold, their numbers would be , , , , , , .
After the theft, there are keyboards left in the store, with numbers a_1, a_2, , a_n. Your task is to determine the minimum number of keyboards that were stolen, given that none of the store employees can recall the starting number .
The first line contains a single integer (1 \leq n \leq 10^3) – the number of keyboards that remain. The second line contains integers a_1, a_2, , a_n (a_i \leq 10^6) – the numbers of the remaining keyboards, presented in random order.
Output the minimum number of keyboards that could have been stolen, considering that the starting number is unknown.
Example 1