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