#!/bin/python import sys n = int(raw_input().strip()) calories = map(int, raw_input().strip().split(' ')) # your code goes here calories.sort(reverse = True) total = 0 i = 0 for cal in calories: total += (cal*(2**i)) i += 1 print total