#include using namespace std; #define rep(i,n) for(ll i=0;ib;i--) #define ll long long int #define pll pair #define Fill(a,x) memset(a,x,sizeof(a)) #define mp make_pair #define pb push_back #define X first #define Y second #define M 1000000007 #define dbg(a) std::cerr<<#a<<"="<<(a)<<"\n" #define dbg1(a,b) std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<"\n" #define dbg2(a,b,c) std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<"\n" #define dbg3(a,b,c,d) std::cerr<<#a<<"="<<(a)<<", "<<#b<<"="<<(b)<<", "<<#c<<"="<<(c)<<", "<<#d<<"="<<(d)<<"\n" #define pos(c) ((c<='9' && c>='0')?c-'0':c-'A'+10 ) ll power(ll x,ll y) { ll ans=1; while(y>0){ if(y&1) ans=(ans*x)%M; x=(x*x)%M; y/=2; } return ans; } ll dx[] = {1,1,0,-1,-1,-1,0,1}, dy[] = {0,1,1,1,0,-1,-1,-1}; const int INF = 2034567891; const ll INF64 = 1234567890123456789ll; const long double pi = 3.1415926535897932384626434; int main() { ll t,n; cin>>n; ll a[n]; rep(i,n) cin>>a[i]; sort(a,a+n); reverse(a,a+n); ll ans=0,sum=0; rep(i,n) { ans+=pow(2,i)*a[i]; } cout<