import java.io.*;
import java.util.*;
import java.math.BigInteger;

public class trains_as {

    public void run() throws IOException {
        Scanner in = new Scanner(new File("trains.in"));
        PrintWriter out = new PrintWriter(new File("trains.out"));

        int n = in.nextInt();

        BigInteger[][] c = new BigInteger[n + 1][n + 1];
        Arrays.fill(c[0], BigInteger.ZERO);
        c[0][0] = BigInteger.ONE;

        for (int i = 1; i <= n; i++) {
            c[i][0] = BigInteger.ONE;
            for (int j = 1; j <= n; j++) {
                c[i][j] = c[i - 1][j - 1].add(c[i - 1][j]);
            }
        }

        BigInteger[] good = new BigInteger[n + 1];
        BigInteger[] bad = new BigInteger[n + 1];
        good[0] = BigInteger.ONE;
        bad[0] = BigInteger.ZERO;

        for (int i = 1; i <= n; i++) {
            bad[i] = BigInteger.ZERO;
            for (int j = 1; j <= i; j++) {
                bad[i] = bad[i].add(c[i][j].multiply(good[i - j]));
            }
            good[i] = BigInteger.valueOf(2).pow(i * (i - 1) / 2).subtract(bad[i]);
        }

        out.println(good[n]);

        in.close();
        out.close();
    }

    public static void main(String[] arg) throws IOException {
        new trains_as().run();
    }
}
