#include <bits/stdc++.h>
using namespace std;
const int maxn = (int)4e3 + 5;
const int mod = (int)1e9 + 7;
int n;
long long C[maxn][maxn];
long long all[maxn], good[maxn];
int main() {
  cin >> n;
  for (int i = 0; i < maxn; i++) C[i][0] = 1;
  for (int i = 1; i < maxn; i++)
    for (int j = 1; j <= i; j++)
      C[i][j] = (C[i - 1][j] + C[i - 1][j - 1]) % mod;
  all[0] = 1;
  for (int i = 1; i <= n; i++) {
    all[i] = (all[i - 1] * 2) % mod;
    for (int j = 2; j <= i; j++) {
      all[i] += C[i - 1][j - 1] * all[i - j] % mod;
      all[i] %= mod;
    }
  }
  good[0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++) {
      good[i] += C[i - 1][j - 1] * good[i - j] % mod;
      good[i] %= mod;
    }
  long long res = (all[n] - good[n] + mod) % mod;
  cout << res << endl;
}
