import java.util.Arrays; import java.util.InputMismatchException; import java.io.IOException; import java.io.PrintWriter; public class hack_46_1 { public static int mod = 1000000007; static FastReader scan = new FastReader(); static PrintWriter out = new PrintWriter(System.out); public static void main(String args[]) { /******************* code ***********************/ int n = scan.nextInt(); int arr[] = scan.nextIntArray(n); Arrays.sort(arr); long sum = 0; for (int i = arr.length - 1; i >= 0; i--) { sum = (long) (sum + (Math.pow(2, arr.length - i - 1)) * arr[i]); } out.println(sum); out.close(); } static class Pair implements Comparable { int x; int y; Pair(int xx, int yy) { x = xx; y = yy; } @Override public int compareTo(Pair o) { if (Long.compare(this.y, o.y) != 0) return Integer.compare(this.y, o.y); else return Long.compare(this.x, o.x); } } public static void debug(Object... o) { System.out.println(Arrays.deepToString(o)); } public static long pow(long x, long n, long mod) { long res = 1; x %= mod; while (n > 0) { if (n % 2 == 1) { res = (res * x) % mod; } x = (x * x) % mod; n /= 2; } return res; } /************** Scanner ********************/ static class FastReader { private byte[] buf = new byte[1024]; private int curChar; private int snumChars; public int read() { if (snumChars == -1) throw new InputMismatchException(); if (curChar >= snumChars) { curChar = 0; try { snumChars = System.in.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (snumChars <= 0) return -1; } return buf[curChar++]; } public String nextLine() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isEndOfLine(c)); return res.toString(); } public String nextString() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } public long nextLong() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } long res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public int nextInt() { int c = read(); while (isSpaceChar(c)) c = read(); int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c < '0' || c > '9') throw new InputMismatchException(); res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public int[] nextIntArray(int n) { int[] arr = new int[n]; for (int i = 0; i < n; i++) { arr[i] = nextInt(); } return arr; } public long[] nextLongArray(int n) { long[] arr = new long[n]; for (int i = 0; i < n; i++) { arr[i] = nextLong(); } return arr; } private boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } } }