/* ____ _____ _ _ _____ / ___| | ____| / \ | | |___ | \___ \ | _| / _ \ | | _____ / / ___) | | |___ / ___ \ | |___ |_____| / / |____/ |_____| /_/ \_\ |_____| /_/ */ #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(typeof((c).begin() 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()) #define modulo(a, b) (a%b<0 ? a%b+b : a%b) bool myfunction (int i,int j) { return (i>j); } ll power(ll x, ll y) { ll temp; if( y == 0) return 1; temp = power(x, y/2); if (y%2 == 0) return temp*temp; else { if(y > 0) return x*temp*temp; else return (temp*temp)/x; } } int main(){ ll n,val; cin>>n; vector vec; for(int i=0; i< n; i++){ cin>>val; vec.push_back(val); } sort(vec.begin(),vec.end(),myfunction); ll cal=0; for(int i=0; i< n; i++){ cal+=(vec[i]*power(2.0,i)); } cout<