#include <bits/stdc++.h>
using namespace std;
const int maxn = 4005;
const long long mod = (int)1e9 + 7;
int n;
long long combo[maxn][maxn];
long long all[maxn], good[maxn];
void add(long long &x, long long y) {
  x += y;
  while (x >= mod) x -= mod;
}
int main() {
  scanf("%d", &n);
  memset(combo, 0, sizeof combo);
  for (int i = 0; i <= n; i++) combo[i][0] = 1;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= i; j++)
      combo[i][j] = (combo[i - 1][j - 1] + combo[i - 1][j]) % mod;
  memset(all, 0, sizeof all);
  all[0] = 1;
  for (int i = 1; i <= n; i++) {
    add(all[i], all[i - 1] * 2ll % mod);
    for (int s = 2; s <= i; s++) {
      add(all[i], combo[i - 1][s - 1] * all[i - s] % mod);
    }
  }
  memset(good, 0, sizeof good);
  good[0] = 1;
  for (int i = 1; i <= n; i++) {
    for (int s = 1; s <= i; s++) {
      add(good[i], combo[i - 1][s - 1] * good[i - s] % mod);
    }
  }
  long long ans = (all[n] - good[n] + mod) % mod;
  ans = (ans % mod + mod) % mod;
  cout << ans << endl;
  return 0;
}
