#include <bits/stdc++.h>
using namespace std;
vector<tuple<int, int, int>> v;
vector<pair<int, int>> v1;
int foo(int n, int r) {
  if (n == r) return 1;
  if (r == 1) return n;
  return foo(n - 1, r) + foo(n - 1, r - 1);
}
int dp[778][778];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  unsigned long long int n, sum, sum1, sum2;
  cin >> n;
  if (n <= 30) {
    sum = foo(n, 7) + foo(n, 6) + foo(n, 5);
    cout << sum;
    printf("\n");
  } else {
    sum1 = (n * (n - 1) * (n - 2) * (n - 3) * (n - 4)) / 120;
    sum2 = (sum1 * (n - 5)) / 6;
    sum = (sum2 * (n - 6)) / 7;
    cout << sum1 + sum2 + sum << "\n";
  }
}
