#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;


int main() {
    /* Enter your code here. Read input from STDIN. Print output to STDOUT */   
    long long n;
    long long c[50];
    long long p = 1;
    cin >> n;
    long long ans =0 ;
    for (int i = 0; i < n; i++) {
        cin >> c[i];
    }
    sort(c, c + n);
    reverse(c, c + n);
    for (int i = 0; i < n; i++) {
        ans += p * c[i];
        p *= 2;
    }
    cout << ans << endl;
    return 0;
}