http://acm.hust.edu.cn/vjudge/contest/view.action?cid=31329#problem/F
f[0] = 1 , f[ i ] = f[ i - 1 ] + 2 ^( n - k - 2 )
import java.util.Scanner; import java.math.BigInteger ; public class Main { public static void main(String[] args ) { Scanner cin = new Scanner( System.in ); BigInteger[] f = new BigInteger[ 10005 ] ; int k = 1 , cnt = 0 ; f[ 0 ] = new BigInteger( "0" ) ; BigInteger d = new BigInteger( "1" ) ; for( int i = 1; i <= 10004 ; ++i ) { f[ i ] = f[ i - 1 ].add( d ) ; cnt++; if( cnt == k ) { cnt = 0 ; k++; d = d.multiply(BigInteger.valueOf(2) ) ; } } while( cin.hasNext()) { int n = cin.nextInt(); System.out.println( f[ n ] ) ; } } }