Journey#10280

Journey

1 saniye
128 megabayt
Çok kolay

Cossack Vus is going on a journey. In Potokolandia cities are located on a straight line and numbered with integers from to . Each city is characterized by a certain value x_i  — the city coordinate. The distance between the cities with numbers and is equal to |x_i-x_j|.

Cossack Vus wants to know the minimum distance he will have to travel when traveling through Potokolandia, provided that he must visit each city at least once and complete the journey in the city where he started. Your task is to find the minimum length of the route, provided that the city where the journey starts and the route remains at your discretion.

Giriş

The first line contains one integer (1\le n\le 100).

The second line contains integers x_1, x_2, \dots, x_n (1\le x_i\le 1000).

Çıktı

Print one integer — the minimum length of the route of Cossack Vus.

Örnekler

Örnek 1

Loading
Loading

Örnek 2

Loading
Loading