#include using namespace std; #define endl '\n' void io(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cout.precision(15); } int n ; vector C ; int main(int argc,char* argv[]) { io() ; #ifndef ONLINE_JUDGE // freopen("inp.txt", "r", stdin) ; // freopen("out.txt", "w", stdout); #endif cin >> n ; long long a ; for(int i = 0 ; i < n ; i++){ cin >> a ; C.push_back(a) ; } sort(C.rbegin() , C.rend()) ; long long p = 1 ; long long ans = 0 ; for(int i = 0 ; i < n ; i++){ ans = ans + 1ll*p*C[i] ; p = p*2ll ; } cout << ans << endl ; return 0 ; }