#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; typedef long long ll; ll v[100]; int main() { int n; cin >> n; for(int i = 0; i < n; i++) cin >> v[i]; sort(v, v + n, greater<int>()); ll ans = 0; for(int i = 0; i < n; i++ ) ans += (1ll << i) * v[i]; cout << ans << '\n'; /* Enter your code here. Read input from STDIN. Print output to STDOUT */ return 0; }