//This is getting accepted! // I HATE BUG // God Of The Bugs // 12/11/2016 #include using namespace std; #define ms(s, n) memset(s, n, sizeof(s)) #define FI first #define SE second #define pb push_back #define mp make_pair #define ll long long #define sz(a) ((int)(a).size()) #define __builtin_popcount __builtin_popcounll #define ld long double typedef pair pii; typedef pair pdd; typedef pair ppi; const double PI = acos(0) * 2; const double EPS = 1e-8; const ll MOD = 1e9 + 7; const int MAXN = 1e5 + 5; const int oo = 1e9; const double foo = 1e30; template int getbit(T s, int i) { return (s >> i) & 1; } template T onbit(T s, int i) { return s | (T(1) << i); } template T offbit(T s, int i) { return s & (~(T(1) << i)); } template int cntbit(T s) { return __builtin_popcounll(s);} template T sqr(T x) { return x * x; } inline void addmod(int& a, int val, int p = MOD) {if ((a = (a + val)) >= p) a -= p;} inline void submod(int& a, int val, int p = MOD) {if ((a = (a - val)) < 0) a += p;} inline int mult(int a, int b, int p = MOD) {return (ll) a * b % p;} int n; ll a[60], ans; int main() { //#ifndef ONLINE_JUDGE // freopen("inp.txt", "r", stdin); //// freopen("out.txt", "w", stdout); //#endif cin >> n; for (int i=0; i> a[i]; sort(a, a + n); ll po2 = 1; for (int i=n-1; i>=0; i--) { ans += po2 * a[i]; po2 *= 2ll; } cout << ans; }