LearnPy Hub
← Arena
EasyRating 1000

Cupcake Walk

After eating the j-th cupcake (counting from 0) with c calories, you must walk 2ʲ × c miles. Choose the order to walk as little as possible. Print the total miles.

Input

n, then n calorie counts.

Output

One integer.

Sample 1

Input
3
1 3 2
Output
11

Sample 2

Input
4
7 4 9 6
Output
79
solution.py
Output appears here
Cupcake Walk · Python Arena problem · LearnPy Hub