Time Limit : sec, Memory Limit : KB
English / Japanese  

Courtesy Call

In Ouchi Village, the houses of the villagers are located along the main street of the village. The main street runs in a straight line from the west end of the village to the east. Mochihito, who has just moved to Ouchi Village, wants to visit all the houses and say hello. Starting from his current location, how far does he have to travel before he can greet all the houses?

Given the current location of Mr. Mochihito and the locations of all the villagers' houses along the main street, write a program to calculate the minimum distance he needs to travel to visit all the houses.

Input

The input is given in the following form

$N$
$x$ $x_1$ $x_2$ ... $x_N$

The first line gives the number of houses of the villagers $N$ ($1 \leq N \leq 100$). The second line, the first $x$ ($0 \leq x \leq 1,000$) gives the location where Motohito is currently located, and the remaining $x_i$ ($0 \leq x_i \leq 1,000$) give the locations of the villagers' houses. The locations of the villagers' houses are all different (if $i \ne j$, then $x_i \ne x_j$). Also, the position of the west end of the road is set to 0.

Output

Output the minimum distance required to travel to visit all the houses on one line.

Sample Input and Output

Sample Input 1

5
0 1 2 3 4 5

Sample Output 1

5

Sample Input 2

6
4 10 2 3 7 4 8

Sample Output 2

10