#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 ans = 0; for(int calories_i = 0; calories_i < n; calories_i++) { int t = calories[n - 1 - calories_i]; ans += (1LL << calories_i) * t; } cout << ans << endl; return 0; }