#include using namespace std; typedef long long ll; typedef pair pii; ll sum = 0; int n; ll c[100]; int main(){ //freopen("input.txt","r",stdin); scanf("%d",&n); for (int i = 0; i < n; ++i){ scanf("%lld",&c[i]); } sort(c,c+n); int cnt = 0; for (int i = n - 1; i>= 0 ; i--){ sum += c[i] * (1ll << cnt); cnt++; } printf("%lld\n",sum ); return 0; }