import java.util.*; import java.io.*; import java.math.*; public class HackerEarth{ static long mod=(long)Math.pow(10,9)+7; static final int lint=Integer.MAX_VALUE; static final double ldouble=Double.MAX_VALUE; public static void main(String args[]) { new Thread(null, new Runnable() { public void run() { try{ solve(); } catch(Exception e){ e.printStackTrace(); } } }, "1", 1 << 26).start(); } public static void solve(){ InputReader in = new InputReader(System.in); PrintWriter w = new PrintWriter(System.out); int num=in.nextInt(); int arr[]=new int[num]; for(int i=0;i=0;i--,j++){ ans=ans+((long)arr[i]*(long)Math.pow(2, j)); } w.println(ans); w.close(); } // static boolean T[][][]; // static void subsetSum(int input[], int total, int count) { // T = new boolean[input.length + 1][total + 1][count+1]; // for (int i = 0; i <= input.length; i++) { // T[i][0][0] = true; // for(int j = 1; j<=count; j++){ // T[i][0][j] = false; // } // } // int sum[]=new int[input.length+1]; // for(int i=1;i<=input.length;i++){ // sum[i]=sum[i-1]+input[i-1]; // } // for (int i = 1; i <= input.length; i++) { // for (int j = 1; j <= (int)Math.min(total,sum[i]); j++) { // for (int k = 1; k <= (int)Math.min(i,count); k++){ // if (j >= input[i - 1]) {//Exclude and Include // T[i][j][k] = T[i - 1][j][k] || T[i - 1][j - input[i - 1]][k-1]; // } else { // T[i][j][k] = T[i-1][j][k]; // } // } // } // } // } // static > // SortedSet> entriesSortedByValues(Map map) { // SortedSet> sortedEntries = new TreeSet>( // new Comparator>() { // @Override public int compare(Map.Entry e1, Map.Entry e2) { // int res = e2.getValue().compareTo(e1.getValue()); // return res != 0 ? res : 1; // } // } // ); // sortedEntries.addAll(map.entrySet()); // return sortedEntries; // } //static TreeMap tm[]; // static LinkedList adj[]; //Adjacency Lists // static int V; // No. of vertices // // Constructor // static void Graph(int v) // { // V = v; // adj = new LinkedList[v]; // // tm = new TreeMap[v]; // for (int i=0; i(); // adj[i] = new LinkedList(); // } // } // // // Function to add an edge into the graph // static void addEdge(int v,int w) // { // //tm[v].put(w, val); // adj[v].add(w); // } // //minimum prime factor of all the numbers less than n // static void minimumPrime(int n){ // int minPrime[]=new int[n+1]; // for (int i = 2; i * i <= n; ++i) { // if (minPrime[i] == 0) { //If i is prime // for (int j = i * i; j <= n; j += i) { // if (minPrime[j] == 0) { // minPrime[j] = i; // } // } // } // } // for (int i = 2; i <= n; ++i) { // if (minPrime[i] == 0) { // minPrime[i] = i; // } // } // } //for marking all prime numbers greater than 1 and less than equal to N // static int sieve(int N) { // boolean isPrime[]=new boolean[N+1]; // for(int i = 0; i <= N;++i) { // isPrime[i] = true; // } // isPrime[0] = false; // isPrime[1] = false; // for(int i = 2; i * i <= N; ++i) { // if(isPrime[i] == true) { //Mark all the multiples of i as composite numbers // for(int j = i * i; j <= N ;j += i) // isPrime[j] = false; // } // } // int count=0; // for(int i=0;i<=N;i++){ // if(isPrime[i]==true){ // count++; // } // } // return count; // } // static long power(long base, long exponent, long modulus){ long result = 1; while (exponent > 0) { if (exponent % 2 == 1) result = (result * base) % modulus; exponent = exponent >> 1; base = (base * base) % modulus; } return result; } static long modInverse(long A, long M) { long x=extendedEuclid(A,M)[0]; return (x%M+M)%M; //x may be negative } static long[] extendedEuclid(long A, long B) { if(B == 0) { long d = A; long x = 1; long y = 0; return new long[]{x,y,d}; } else { long arr[]=extendedEuclid(B, A%B); long temp = arr[0]; arr[0] = arr[1]; arr[1] = temp - (A/B)*arr[1]; return arr; } } // static boolean isPrime(int n) { // if(n < 2) return false; // if(n == 2 || n == 3) return true; // if(n%2 == 0 || n%3 == 0) return false; // int sqrtN = (int)Math.sqrt(n)+1; // for(int i = 6; i <= sqrtN; i += 6) { // if(n%(i-1) == 0 || n%(i+1) == 0) return false; // } // return true; // } // static long modpowIter(long a, long b) { // long ans=1; // while(b != 0) { // if(b%2==1) // ans=(ans*a)%mod; // a=(a*a)%mod; // b=b>>1; // } // return ans; // } static class InputReader { private final InputStream stream; private final byte[] buf = new byte[8192]; private int curChar, numChars; private SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public int read() { if (numChars == -1) { throw new InputMismatchException(); } if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 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 readString() { 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; } public boolean isSpaceChar(int c) { if (filter != null) return filter.isSpaceChar(c); return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } private boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } } class Node{ ArrayList arr=new ArrayList(); public void set(){ } }