#include <bits/stdc++.h>
using namespace std;
int32_t main() {
  long long n;
  cin >> n;
  long long ans = 0;
  long long a = n * (n - 1) * (n - 2) * (n - 3) * (n - 4);
  a = a / (2 * 3 * 4 * 5);
  ans = a;
  a = a * (n - 5) / 6;
  ans += a;
  a = a * (n - 6) / 7;
  ans += a;
  cout << ans << "\n";
}
