/*Every day, the words cross my mind. "If I had done this back then..." but they don't take the sincere form of regret. The words are just an excuse that come to my mind then disappear.*/ #include #define MAX 200005 #define inf 10000000000000000 #define ll long long #define eps 0.00000000001 #define MOD 1000000007 #define s(x) scanf("%d", &x); using namespace std; ll a[MAX]; int main() { int n; cin >> n; for(int i = 0 ; i < n; i++) { cin >> a[i]; } sort(a, a + n); reverse(a , a + n); ll answer = 0; for(int i = 0; i < n; i++) { answer+= a[i] * powl(2, i); } cout << answer << endl; return 0; }