#include using namespace std; int main(){ int n; long long r; cin >> n; vector calories(n); for (auto &i: calories) cin >> i; sort(calories.rbegin(), calories.rend()); r = 0; for (int i = 0; i < n; i++) { r += calories[i] * pow(2,i); } cout << r; return 0; }