#!/bin/python3 import sys n = int(input().strip()) c = list(map(int, input().strip().split(' '))) sum1 = 0 # your code goes here ind = 0 c = [int(i) for i in c] c.sort(reverse=True) for i in c: sum1 = sum1 + (pow(2,ind)*i) ind = ind + 1 print(sum1)