#include <bits/stdc++.h>
int main() {
  static int ch[4000 + 1][4000 + 1], dp[4000 + 1], pp[4000 + 1];
  int n, i, j, k, p;
  long long x, y, ans;
  scanf("%d", &n);
  ch[0][0] = 1;
  for (i = 1; i <= n; i++) {
    ch[i][0] = 1;
    for (j = 1; j <= n; j++)
      ch[i][j] = (ch[i - 1][j] + ch[i - 1][j - 1]) % 1000000007;
  }
  dp[0] = 1;
  for (i = 1; i <= n; i++) {
    x = 0;
    for (j = 2; j <= i; j++) {
      y = dp[i - j];
      if (dp[i - j] != 0) x = (x + y * ch[i - 1][j - 1]) % 1000000007;
    }
    dp[i] = x;
  }
  p = 1;
  for (i = 0; i <= n; i++) {
    pp[i] = p - 1;
    p = p * 2 % 1000000007;
  }
  ans = 0;
  for (k = 1; k <= n; k++)
    ans = (ans + (long long)pp[k] * ch[n][k] % 1000000007 * dp[n - k]) %
          1000000007;
  printf("%lld\n", ans);
  return 0;
}
