#include using namespace std; int main(){ int n; cin >> n; vector calories(n); for(int calories_i = 0; calories_i < n; calories_i++){ cin >> calories[calories_i]; } // your code goes here long int w = 0; long int p2 = 1; sort(calories.begin(),calories.end()); for (int i = calories.size()-1; i>=0; i--) { w=w+calories[i]*p2; p2*=2; } cout << w << endl; return 0; }