import java.io.*; import java.util.*; public class Main { static FastScanner in; static int n, c[]; public static void main(String[] args) throws IOException { // System.setOut(new PrintStream(new BufferedOutputStream(new FileOutputStream("nocross.out")), true)); in = new FastScanner(System.in); // in = new FastScanner("nocross.in"); // in = new FastScanner("input.txt"); n = in.nextInt(); c = new int[n]; for (int i = 0;i < n;i++) { c[i] = in.nextInt(); } Arrays.sort(c); long ans = 0; int j = n - 1; for (int i = 0; i < n; i++) { ans += c[i] * Math.pow(2, j); j--; } System.out.println(ans); } } class FastScanner { BufferedReader br; StringTokenizer tokenizer; FastScanner(String fileName) throws FileNotFoundException { this(new FileInputStream(new File(fileName))); } FastScanner(InputStream is) { br = new BufferedReader(new InputStreamReader(is)); } String nextLine() throws IOException { tokenizer = null; return br.readLine(); } String next() throws IOException { if (tokenizer == null || !tokenizer.hasMoreTokens()) { String line = br.readLine(); if (line == null) { return null; } tokenizer = new StringTokenizer(line); } return tokenizer.nextToken(); } int nextInt() throws IOException { return Integer.parseInt(next()); } long nextLong() throws IOException { return Long.parseLong(next()); } char nextChar() throws IOException { return next().charAt(0); } }