/* Author : akgarhwal Date : 14-02-2017 21:28:26 Description : */ #include using namespace std; typedef long long ll; typedef vector vi; typedef pair ii; #define sz(a) int((a).size()) #define pb push_back #define all(c) (c).begin(),(c).end() #define tr(c,i) for(auto i = (c).begin(); i != (c).end(); i++) #define present(c,x) ((c).find(x) != (c).end()) #define cpresent(c,x) (find(all(c),x) != (c).end()) long long pow2(long long x,long long y){ long long res=1; while(y){ if((y&1)==1){ res = res*x; } x=x*x; y=y>>1; } return res; } int main(){ //freopen("input.txt", "r", stdin); //freopen("output.txt", "w", stdout); int n; cin>>n; vector v(n,0); for(int i=0; i< n; i++){ cin>>v[i]; } sort(all(v)); ll res=0; ll j=0; for(int i=n-1; i>=0 ; i--){ res += (v[i]*pow2(2,j++)); } cout<