#!/bin/python3 import sys n = int(input().strip()) calories = sorted(list(map(int, input().strip().split(' '))), reverse = True) # your code goes here prev = 0 result = 0 for i in range(len(calories)): result = result + calories[i] * (2**i) print(result)