#!/bin/python3 import sys n = int(input().strip()) calories = sorted(list(map(int, input().strip().split(' '))))[::-1]; # your code goes here j = 0; miles = 0; for i in calories: miles += i*(2**j); j+=1; print(miles);