#include <bits/stdc++.h>
using namespace std;
long long fact(long long n) {
  long long ans = 1;
  for (long long i = 2; i <= n; i++) ans *= i;
}
long long c(long long n, long long r) {
  if (r == 1)
    return n;
  else if (r == n)
    return 1;
  else
    return fact(n) / (fact(n - r) * fact(r));
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  cin >> n;
  long long c5 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) / 120;
  long long c6 = c5 * (n - 6 + 1) / 6;
  long long c7 = c6 * (n - 7 + 1) / 7;
  cout << c5 + c6 + c7;
}
