#!/bin/python import sys n = int(raw_input().strip()) calories = sorted(map(int, raw_input().strip().split(' ')))[::-1] # your code goes here s = 0 count = 0 for c in calories: s = s+ (2**count ) * c count=count+1 print s