#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #define pb push_back #define mp make_pair #define rep(i,a,b) for(int i=a;i<=b;i++) #define ren(i,a,b) for(int i=a;i>=b;i--) #define ff first #define ss second #define pll pair #define pii pair #define vll vector #define vii vector #define gi(n) scanf("%d",&n) #define gll(n) scanf("%lld",&n) #define gstr(n) scanf("%s",n) #define gl(n) cin >> n #define oi(n) printf("%d",n) #define oll(n) printf("%lld",n) #define ostr(n) printf("%s",n) #define ol(n) cout << n #define os cout<<" " #define on cout<<"\n" #define o2(a,b) cout< > mat; int main() {ios_base::sync_with_stdio(false); int n; cin>>n; ll a[50]; rep(i,0,n-1)cin>>a[i]; sort(a,a+n); reverse(a,a+n); ll ans=0,s=0; rep(i,0,n-1) { s+=a[i]; ans+=(1ll<<(i))*a[i]; } ol(ans); return 0; }