#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, a, b, c, v;
  cin >> n;
  a = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) / 120;
  b = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) / 720;
  c = b * (n - 6) / 7;
  v = a + b + c;
  cout << v;
  return 0;
}
