n = int(input()) lst = sorted(list(map(int, input().split())),reverse = True) x = 0 for i in range(n): x += lst[i]*(2**i) print(x)