#include using namespace std; int main(){ int n; cin >> n; int c[50]; for(int i = 0; i < n; ++i) cin>>c[i]; long long tim = 1; long long ans = 0; sort(c,c+n); for(int i = n-1; i >= 0; --i) { ans += tim*c[i]; //cout<< ans << endl; tim *= 2; } cout<< ans << endl; return 0; }