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