#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const int N = 1005;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
int lcm(int a, int b) { return a / gcd(a, b) * b; }
int main() {
  long long n;
  while (~scanf("%I64d", &n)) {
    long long sum = 0;
    long long ans = n;
    for (int i = 1; i <= 5; i++) ans = ans * (n - i);
    ans /= 720;
    ans = ans * (n - 6) / 7;
    sum += ans;
    ans = n;
    for (int i = 1; i <= 5; i++) ans = ans * (n - i);
    sum += ans / 720;
    ans = n;
    for (int i = 1; i <= 4; i++) ans = ans * (n - i);
    sum += ans / 120;
    printf("%I64d\n", sum);
  }
  return 0;
}
