#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 miles = 0, dvojka = 1; for (int i = n-1; i >= 0; i--) miles += calories[i]*dvojka, dvojka*=2; cout << miles; return 0; }