a=input()
b=map(int,raw_input().split())
b.sort(reverse=True)
count=0
for i in xrange(a):
    count+=b[i]*(2**i)
print count