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