import java.util.*; import java.io.*; public class probem1 { public static void main(String args[]) throws Exception { Scanner in = new Scanner(System.in); int n = in.nextInt(); long result = 0; int arr[] = new int[n]; for (int i = 0; i < n; i++) { arr[i] = in.nextInt(); } Arrays.sort(arr); int j = n - 1; for (int i =0; i < n; i++) { result += ((long) Math.pow(2, i)) * arr[j--]; } System.out.println(result); } public static long gcd(long a, long b) { if(b == 0L) { return a; } return gcd(b, a % b); } public static long lcm(long a, long b) { return a * b / gcd(a, b); } }