import java.io.*;
import java.util.*;

public class baskerville_vd_cube {

	long MOD = (long) (1e+9 + 7);

	long pow(long a, int b) {
		long res = 1;
		long mul = a;
		while (b > 0) {
			if (b % 2 == 1) {
				res = (res * mul) % MOD;
			}
			b /= 2;
			mul = (mul * mul) % MOD;
		}
		return res;
	}

	void solve() throws IOException {
		int n = nextInt();
		long[][] c = new long[n + 1][n + 1];
		c[0][0] = 1;
		for (int i = 1; i <= n; i++) {
			c[i][0] = 1;
			for (int j = 1; j <= i; j++) {
				c[i][j] = (c[i - 1][j] + c[i - 1][j - 1]) % MOD;
			}
		}
		long[][] res = new long[n + 1][n + 1];
		for (int i = 1; i <= n; i++) {
			for (int j = 1; j < i; j++) {
				int left = i - j;
				for (int k = 1; k <= left; k++) {
					long cur = (c[i][j] * pow((pow(2, j) - 1 + MOD) % MOD, k))
							% MOD;
					cur = (cur * pow(2, j * (left - k))) % MOD;
					cur = (cur * res[left][k]) % MOD;
					res[i][j] = (res[i][j] + cur) % MOD;
				}
			}
			res[i][i] = 1;
		}
		long result = 0;
		for (int i = 1; i <= n; i++) {
			result = (result + res[n][i]) % MOD;
		}
		out.println(result);

	}

	void run() throws IOException {
		in = new BufferedReader(new FileReader("baskerville.in"));
		out = new PrintWriter("baskerville.out");
		solve();
		out.close();
	}

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

	BufferedReader in;
	StringTokenizer st;
	PrintWriter out;

	String next() throws IOException {
		while (st == null || !st.hasMoreTokens()) {
			st = new StringTokenizer(in.readLine());
		}
		return st.nextToken();
	}

	int nextInt() throws IOException {
		return Integer.parseInt(next());
	}

	long nextLong() throws IOException {
		return Long.parseLong(next());
	}

	double nextDouble() throws IOException {
		return Double.parseDouble(next());
	}

}
