#CCBCHBAHAI0000149. Bãi đỗ xe (Parking)

Bãi đỗ xe (Parking)

Parking

Source: Kattis

Version: Phuoc Hung OJ Extended

Problem Statement

A street is represented by an integer number line. Michael must visit nn stores, and store ii is at integer position xix_i. He parks his car at one position and must return to the car after visiting all stores.

Compute the minimum total walking distance needed to visit all stores and return to the parked car.

Input

  • The first line contains an integer nn, the number of stores.
  • The second line contains nn integers x0,x1,…,xn−1x_0,x_1,\ldots,x_{n-1}, the store positions.

Output

Print one integer, the minimum walking distance.

Subtasks

Subtask 1 (100 points): 1≤n≤201\le n\le20 and 0≤xi≤990\le x_i\le99.

Examples

Input

4
24 13 89 37

Output

152

Explanation

The leftmost store is at 1313 and the rightmost at 8989. Visiting all stores and returning to the car requires covering the interval of length 89−13=7689-13=76 in both directions, so the minimum distance is 2⋅76=1522\cdot76=152.