#include using namespace std; int main(){ int n; cin >> n; vector c(n); for(int calories_i = 0; calories_i < n; calories_i++){ cin >> c[calories_i]; } // your code goes here sort(c.rbegin(), c.rend()); unsigned long long r = 0, two = 1; for (auto x : c) { r += (x * two); two = two << 1; } cout << r << endl; return 0; }