#!/bin/python import sys n = int(raw_input().strip()) calories = map(int, raw_input().strip().split(' ')) miles = 0 sc = sorted(calories, reverse=True) counter = 0 for c in sc: miles = miles + (c*(2**counter)) counter += 1 print miles