#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]; } sort(c.begin(),c.end()); int k = c.size(); long long sum=0; for(int i=c.size()-1;i>=0;i--) { sum+=pow(2,k-i-1)*c[i]; } printf("%lld\n",sum); // your code goes here return 0; }