/* Pratik Gajjar */ #include using namespace std; /* #include #include using namespace __gnu_pbds; template using ordered_set = tree, rb_tree_tag, tree_order_statistics_node_update>; */ typedef long long ll; typedef long double ld; typedef vector vl; typedef pair pll; typedef vector vpll; typedef set setl; typedef map msl; typedef map mll; #define sortv(x) sort(x.begin(),x.end()) #define all(v) v.begin() , v.end() #define UNIQUE(c) (c).resize(unique(all(c)) - (c).begin()) #define binarysearch(v, n) binary_search(all(v),n) #define rev(v) reverse(all(v)) #define pb push_back #define MP make_pair #define F first #define S second #define REP(i, a, b) for (ll i = a ; i < b ; i++) #define REPZ(i,b) for (ll i = 0 ; i < b ; i++) #define REPV(x , it , c ) for (x ::iterator it = (c).begin(); it != (c).end(); it++) const ll INF = LONG_MAX-SHRT_MAX ; const ll MINF = LLONG_MIN; const ll mod = 1000000007; const ld PI = 2 * acos(0.0) ; int main() { cout << fixed <> n ; ll arr[n]; REPZ(i,n) cin >> arr[i] ; sort(arr , arr + n ); ll ans = 0 , cnt = 0 ; for(int i = n-1 ; i >=0 ; i--) { ans += pow(2,cnt)*arr[i] ; cnt++; } cout << ans << "\n" ; return 0; }