#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]; } sort(calories.begin(),calories.end()); long long stepen = 1,ukupno = 0; for(int i = n-1; i >= 0; i--){ ukupno += calories[i]*stepen; stepen *= 2; } cout << ukupno << endl; // your code goes here return 0; }