#include #include #include #include #include using namespace std; int main() { int n, c[100]; cin >> n; long long result = 0; for (int i = 0; i < n; ++i){ cin >> c[i]; } sort(c, c + n); reverse(c, c + n); for (int i = 0; i < n; ++i) result += 1ll * round(pow(2, i)) * c[i]; cout << result; return 0; }