#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
#define MOD 1000000007
#define MODSET(d) if ((d) >= MOD) d %= MOD;
#define MODNEGSET(d) if ((d) < 0) d = ((d % MOD) + MOD) % MOD;
#define MODADDSET(d) if ((d) >= MOD) d -= MOD;
#define MODADDWHILESET(d) while ((d) >= MOD) d -= MOD;
 
#define cint(d) scanf("%d", &d)
#define cint2(a, b) scanf("%d %d", &a, &b)
#define cint3(a, b, c) scanf("%d %d %d", &a, &b, &c)
#define cint4(a, b, c, d) scanf("%d %d %d %d", &a, &b, &c, &d)
 
#define clong(d) scanf("%lld", &d)
#define clong2(a, b) scanf("%lld %lld", &a, &b)
#define clong3(a, b, c) scanf("%lld %lld %lld", &a, &b, &c)
#define clong4(a, b, c, d) scanf("%lld %lld %lld %lld", &a, &b, &c, &d)
 
#define foreach(v, c) for(__typeof( (c).begin()) v = (c).begin();  v != (c).end(); ++v)
#define revforeach(v, c) for(__typeof( (c).rbegin()) v = (c).rbegin();  v != (c).rend(); ++v)
#define ALL(v) (v).begin(), (v).end()
 
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define fi first
#define se second
 
using namespace std;
using namespace __gnu_pbds;
 
#ifdef VSP4
//Debugging Template Author:  Nikhil Garg
 
#define debug(args...)  cout << "Line No = " <<  __LINE__ << " >\t"; (Debugger()) , args
 
class Debugger
{
public:
    Debugger(const std::string& _separator = ", ") :
            first(true), separator(_separator){}
 
    template<typename ObjectType>
    Debugger& operator , (const ObjectType& v)
    {
        if(!first)
            std::cout << separator;
        std::cout << v;
        first = false;
        return *this;
    }
    ~Debugger() {  std::cout << endl;}
 
private:
    bool first;
    std::string separator;
};
 
template <typename T1, typename T2>
inline std::ostream& operator << (std::ostream& os, const std::pair<T1, T2>& p)
{
    return os << "(" << p.first << ", " << p.second << ")";
}
 
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::vector<T>& v)
{
    bool first = true;
    os << "[";
    for(unsigned int i = 0; i < v.size(); i++)
    {
        if(!first)
            os << ", ";
        os << v[i];
        first = false;
    }
    return os << "]";
}
 
template<typename T>
inline std::ostream &operator << (std::ostream & os,const std::set<T>& v)
{
    bool first = true;
    os << "[";
    for (typename std::set<T>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
    {
        if(!first)
            os << ", ";
        os << *ii;
        first = false;
    }
    return os << "]";
}
 
template<typename T1, typename T2>
inline std::ostream &operator << (std::ostream & os,const std::map<T1, T2>& v)
{
    bool first = true;
    os << "[";
    for (typename std::map<T1, T2>::const_iterator ii = v.begin(); ii != v.end(); ++ii)
    {
        if(!first)
            os << ", ";
        os << *ii ;
        first = false;
    }
    return os << "]";
}
 
#else
#define debug(args...)                  // Just strip off all debug tokens
#endif
 
typedef long long int slong;
typedef pair<int, int> pii;
typedef pair<slong, slong> pll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;
 
const int MAXN = 1e3;
const int SQRTN = 400;
const int LOGN = 16;
const int INT_INFINITY = 1001001001;
const slong LONG_INFINITY = 2001001001001001001ll;
const double EPS = 1e-6;
 
const int LIMIT = 1e3;

int n;
int c[MAXN+5];

int main()
{
    #ifdef VSP4
        freopen("input.txt", "r", stdin);
        freopen("output.txt", "w", stdout);
    #endif
    
    cout.tie(0);
    
    int t, i, j, d;
    
    //cint(t);
    
    //while (t--)
    {
		cint(n);
		
		for (i = 1; i <= n; i++)
		{
			cint(c[i]);
		}
		
		sort(c+1, c+n+1, greater<int>());
		
		slong ans = 0;
		
		for (i = 1; i <= n; i++)
		{
			ans += powl(2, i-1)*c[i];
		}
		
		cout << ans << "\n";
	}
	
    return 0;
}