#!/bin/python3 import sys n = int(input().strip()) cal = list(map(int, input().strip().split(' '))) # your code goes here cal = sorted(cal, reverse=True) q, l = 0, 0 for i in cal: q = q + (i*2**l) l += 1 print(q)