AT_awc0004_c 温度調整の最小コスト

Description

Takahashi is going to conduct a chemistry experiment. In this experiment, he needs to process all $ N $ reagents, each exactly once. The processing temperature of reagent $ i $ $ (1 \leq i \leq N) $ is $ H_i $ degrees. The temperature of the experimental apparatus is initially set to $ 0 $ degrees. To process a reagent, the apparatus temperature must be set to exactly match the processing temperature of that reagent. Takahashi can freely choose the order in which to process the reagents. After processing all reagents, he must return the apparatus temperature to $ 0 $ degrees to finish the experiment. When changing the apparatus temperature from $ a $ degrees to $ b $ degrees, the energy consumption is $ |a - b| $ . If the order of processing the reagents is $ (p_1, p_2, \ldots, p_N) $ (a permutation of $ (1, 2, \ldots, N) $ ), the total energy consumption is $$|H_{p_1}| + |H_{p_2} - H_{p_1}| + \dots + |H_{p_N} - H_{p_{N-1}}| + |H_{p_N}|$$ Here, the first term corresponds to the cost of changing from the initial $ 0 $ degrees to the processing temperature of the first reagent, and the last term corresponds to the cost of returning from the processing temperature of the last reagent to $ 0 $ degrees. Takahashi wants to minimize the total energy consumption by optimally choosing the order in which to process the reagents. Find the minimum total energy consumption.

Input Format

> $ N $ $ H_1 $ $ H_2 $ $ \cdots $ $ H_N $ - The first line contains an integer $ N $ , representing the number of reagents. - The second line contains $ N $ integers $ H_1, H_2, \ldots, H_N $ separated by spaces, representing the processing temperature of each reagent.

Output Format

Output the minimum total energy consumption as an integer on a single line.

Explanation/Hint

### Constraints - $ 1 \leq N \leq 2 \times 10^5 $ - $ -10^9 \leq H_i \leq 10^9 $ - All inputs are integers