n = int(input().strip()) ci = list(map(int, input().strip().split())) ci.sort(reverse=True) miles = 0 for i in range(n): miles += (ci[i]*pow(2,i)) print(miles)