#include <bits/stdc++.h>

using namespace std;

#define pb push_back
#define mp make_pair
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef double dbl;

int n;
ll ans;
int mas[44];

void load () {
	cin >> n;
	for (int i = 0; i < n; i++) {
		cin >> mas[i];
	}
}

void solve () {
	sort (mas, mas + n);
	reverse (mas, mas + n);
	for (int i = 0; i < n; i++) {
		ans += (1ll << i) * mas[i];
	}
	cout << ans << endl;
}
	
int main () {
#ifdef LOCAL
	freopen ("file.in", "r", stdin);
	freopen ("file.out", "w", stdout);
#endif 

	ios_base::sync_with_stdio (false); 
	cin.tie (0);

	load ();
	solve ();

	return 0;
}