/* ta yag odo batorshihiin code harj bn */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; typedef long long LL; typedef long long ll; const ll MOD = 1e9 + 7; const ll INFl = 9223372036854775807ll; const int inf = (1 << 28) - 1; #define ff first #define ss second #define pb push_back #define _N 100005 #define mk make_pair ll power(ll x, ll y, ll z) { ll t = 1; while (y > 0) { if (y % 2) { t = (t * x) % z; } x = (x * x) % z; y /= 2; } return t; } int movex[4] = {0, 1, -1, 0}; int movey[4] = {1, 0, 0, -1}; int movexx[8] = {-1, 0, 1, 1, 1, 0, -1, -1}; int moveyy[8] = {1, 1, 1, 0, -1, -1, -1, 0}; ll sqr (ll x) { return x * x; } int n, a[_N]; int main () { int i; scanf ("%d", &n); for (i = 0;i < n; i ++) { scanf ("%d", &a[i]); } sort (a, a + n); long long ans = 0ll, def = 1ll; for (i = n -1 ;i >= 0; i --) { ans += a[i] * 1ll * def; def *= 2ll; } printf ("%lld", ans); return 0; }