#!/bin/python3 import sys n = int(input().strip()) cal = list(map(int, input().strip().split(' '))) m=len(cal)-1 cal.sort() total=0 for i in cal: total+=i*(2**m) m-=1 print(total)