n=int(raw_input()) a=[int(s) for s in raw_input().split()] a.sort() s=0 x=len(a) for i in range(x): s+=(2**i)*a[x-i-1] print s