n = input()
x = list(map(int, input().split()))

x.sort()

erg = 0;
for i in range(len(x)):
    erg += x[i] * (2** (len(x) - i - 1))

print(erg)