#!/bin/python3 import sys n = int(input().strip()) calories = list(map(int, input().strip().split(' '))) calories.sort(reverse=True) miles = 0 exp = 0 for c in calories: miles += c * (2**exp) exp += 1 print(miles)