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