#!/bin/python3 import sys n = int(input().strip()) calories = list(map(int, input().strip().split(' '))) total = 0 sort = sorted(calories) j = 0 for c in sort[::-1]: total += (2 ** j) * c j += 1 print(total)