#include #define endl '\n' #define Int long long #define pb push_back #define mp make_pair using namespace std; const int maxN = 45; int n, a[maxN]; int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin>>n; for(int i = 0; i < n; i++) { cin>>a[i]; } sort(a, a + n); Int curr_pow = 1, ans = 0; for(int i = n - 1; i >= 0; i--) { ans += curr_pow * a[i]; curr_pow *= 2; } cout<