#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
const int maxn = 4005;
int c[maxn][maxn];
int cnt[maxn], cnt2[maxn];
void add(int &a, long long b) { a = (a + b) % MOD; }
int main() {
  int n;
  scanf("%d", &n);
  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;
  }
  cnt[0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j + i <= n; j++)
      add(cnt[i + j], (long long)cnt[i] * c[n - i - 1][j - 1]);
  }
  cnt2[0] = 1;
  for (int i = 0; i < n; i++) {
    for (int j = 1; j + i <= n; j++)
      add(cnt2[i + j], (long long)cnt2[i] * c[n - i - 1][j - 1]);
    add(cnt2[i + 1], cnt2[i]);
  }
  int answer = (cnt2[n] - cnt[n] + MOD) % MOD;
  cout << answer << endl;
  return 0;
}
