#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
int main(int argc, char *argv[]) {
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  vector<vector<int>> choose{vector<int>{1}};
  for (int i = 1; i <= N; ++i) {
    choose.push_back(vector<int>{1});
    for (int j = 1; j < i; ++j) {
      choose.back().push_back((choose[i - 1][j] + choose[i - 1][j - 1]) % MOD);
    }
    choose.back().push_back(1);
  }
  vector<vector<int>> equivalenceRelations{vector<int>{1}};
  for (int n = 1; n < N; ++n) {
    equivalenceRelations.push_back(vector<int>{0});
    for (int k = 1; k < n; ++k) {
      equivalenceRelations.back().push_back(
          (((long long)equivalenceRelations[n - 1][k] * k) % MOD +
           equivalenceRelations[n - 1][k - 1]) %
          MOD);
    }
    equivalenceRelations.back().push_back(1);
  }
  vector<long long> equivalenceRelationsBySetSize;
  for (int i = 0; i < N; ++i) {
    int relations = 0;
    for (int j : equivalenceRelations[i]) {
      relations += j;
      relations %= MOD;
    }
    equivalenceRelationsBySetSize.push_back(relations);
  }
  int binaryRelations = 0;
  for (int i = 1; i <= N; ++i) {
    binaryRelations +=
        (equivalenceRelationsBySetSize[N - i] * choose[N][i]) % MOD;
    binaryRelations %= MOD;
  }
  cout << binaryRelations << endl;
  return 0;
}
