Chinese New Year is coming.
Bob decides to say “Happy New Year” to his friends.
Bob and his friends reside on the same street.
We can view the street as a straight line, and the position of their houses as points on the straight line.
Bob is at his home at begining.
He wants to visit each of his friend at least once, and then go back to his home.
Because he is too lazy to move, can you help him to find out the minimun distance he should move?
One integer N on the first line, denoting the number of Bob’s friends.
The second line contains N+1 distinct number x0,x1,x2,...,xn
x0 represents the position of Bob’s house.
x1,x2,...,xn represents the position of Bob’s friends.
It’s guaranteed that:
Print the minimun distance he should move in one line.
Remember ‘\n’ on the end of line.