#include using namespace std; typedef long long ll; #define clr(a) (a.clear()) #define sz(x) (int)x.size() #define mem(a,b) memset(a, b, sizeof(a)) #define Unique(store) store.resize(unique(store.begin(),store.end())-store.begin()) #define pb push_back #define X first #define Y second typedef pair pii; typedef pair pll; const int inf = 1E9; const ll mod = 1LL; #define SZ 100010 int main() { #if defined JESI // freopen("1.txt", "r", stdin); // freopen("2.txt", "w", stdout); #endif ios::sync_with_stdio(false); int n; cin >> n; vector a(n); for (auto &x: a) cin >> x; sort(a.rbegin(), a.rend()); ll ans = 0; for (ll i = 0; i < n; i++) { ans += a[i] * (1LL << i); } cout << ans << endl; return 0; }