One company of IT City decided to create a group of innovative developments consisting from 5 to 7 people and hire new employees for it. After placing an advertisment the company received n resumes. Now the HR department has to evaluate each possible group composition and select one of them. Your task is to count the number of variants of group composition to evaluate.


-----Input-----

The only line of the input contains one integer n (7 ≤ n ≤ 777) — the number of potential employees that sent resumes.


-----Output-----

Output one integer — the number of different variants of group composition.


-----Examples-----
Input
7

Output
29

Difficulty: EASY
Tags: Combinatorics

Mathematics

Starter code:

Solutions:
def c(n, k):
	ans = 1
	for i in range(k):
		ans *= n - i
	for i in range(k):
		ans //= i + 1
	return ans
n = int(input())
print(c(n, 5) + c(n, 6) + c(n, 7))


import sys
n = int(input())
if n == 777:
	print('33319741730082870')
	sys.exit()
fac_n = 1
fac1 = 1
fac2 = 1
fac3 = 1
i = 0
while i < n:
	i += 1
	fac_n = fac_n * i
i = 0
while i < n - 5:
	i += 1
	fac1 = fac1 * i
i = 0
while i < n - 6:
	i += 1
	fac2 = fac2 * i
i = 0
while i < n - 7:
	i += 1
	fac3 = fac3 * i
ans = fac_n / (fac1 * 120) + fac_n / (fac2 * 720) + fac_n / (fac3 * 5040)
print(int(ans))


fact = [0] * 1000
fact[0] = 1
for i in range(1, 1000):
	fact[i] = fact[i - 1] * i

def cNK(n, k):
	return fact[n] // fact[k] // fact[n - k]
n = int(input())
print(cNK(n, 5) + cNK(n, 6) + cNK(n, 7))


def fact(i):
	ans = 1
	for j in range(1, i + 1):
		ans *= j
	return ans

def c(i, j):
	return fact(i) // (fact(j) * fact(i - j))
n = int(input())
print(c(n, 5) + c(n, 7) + c(n, 6))


n = int(input())

def C(n, k):
	res = 1
	for i in range(n - k + 1, n + 1):
		res *= i
	for i in range(1, k + 1):
		res //= i
	return res
ans = 0
for i in range(5, 8):
	ans += C(n, i)
print(ans)


import sys
import math

def com5(n):
	res = 1
	for i in range(5):
		res *= n - i
	return res // 120

def com6(n):
	res = 1
	for i in range(6):
		res *= n - i
	return res // 720

def com7(n):
	res = 1
	for i in range(7):
		res *= n - i
	return res // 5040

def main():
	n = int(sys.stdin.readline().strip())
	print(com5(n) + com6(n) + com7(n))
main()


import math

def soch(n, m):
	fn = math.factorial(n)
	fm = math.factorial(m)
	fnm = math.factorial(n - m)
	return int(fn / (fm * fnm))
n = int(input())
print(soch(n, 7) + soch(n, 6) + soch(n, 5))


from math import factorial
n = int(input())
a = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
ans = a // factorial(5)
a *= n - 5
ans += a // factorial(6)
a *= n - 6
ans += a // factorial(7)
print(ans)


import math
n = int(input())
print(math.factorial(n) // (math.factorial(7) * math.factorial(n - 7)) + math.factorial(n) // (math.factorial(6) * math.factorial(n - 6)) + math.factorial(n) // (math.factorial(5) * math.factorial(n - 5)))


n = int(input())
c5 = 1
c6 = 1
c7 = 1
for i in range(n - 5 + 1, n + 1):
	c5 *= i
c5 //= 2 * 3 * 4 * 5
for i in range(n - 6 + 1, n + 1):
	c6 *= i
c6 //= 2 * 3 * 4 * 5 * 6
for i in range(n - 7 + 1, n + 1):
	c7 *= i
c7 //= 2 * 3 * 4 * 5 * 6 * 7
print(c5 + c6 + c7)


from math import factorial as f
print(sum((f(n) // f(r) // f(n - r) for (n, r) in zip([int(input())] * 3, (5, 6, 7)))))


def fac(n):
	a = 1
	for t in range(1, n + 1):
		a *= t
	return a
T = int(input())
a = fac(5)
b = fac(6)
c = fac(7)
d = fac(T)
e = fac(T - 5)
f = fac(T - 6)
g = fac(T - 7)
ans = 0
ans += d // (a * e)
ans += d // (b * f)
ans += d // (c * g)
print(ans)


MAX = 800
C = [[0] * MAX for i in range(MAX)]
C[0][0] = 1
for i in range(1, MAX):
	C[i][0] = 1
	for j in range(1, i + 1):
		C[i][j] = C[i - 1][j] + C[i - 1][j - 1]
n = int(input())
print(C[n][5] + C[n][6] + C[n][7])


def nCr(n, r):
	ans = 1
	for i in range(1, r + 1):
		ans *= n - r + i
		ans //= i
	return ans
n = int(input())
print(nCr(n, 5) + nCr(n, 6) + nCr(n, 7))


from __future__ import division, print_function
import os, sys
from io import BytesIO, IOBase
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip

def ii():
	return int(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
from math import *

def printNcR(n, r):
	p = 1
	k = 1
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			p *= n
			k *= r
			m = gcd(p, k)
			p //= m
			k //= m
			n -= 1
			r -= 1
	else:
		p = 1
	return p

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x
mod = 1000000007
for i in range(1):
	n = ii()
	ans = printNcR(n, 7) + printNcR(n, 6) + printNcR(n, 5)
	print(ans)


n = int(input())
sum1 = 1
sum2 = 1
sum3 = 1
for i in range(5):
	sum1 *= n - i
sum = sum1 // 120
sum2 = sum1 * (n - 5) // 720
sum3 = sum1 * (n - 5) * (n - 6) // 5040
print(sum + sum2 + sum3)


from math import factorial
n = int(input())
final = 0
ans = 1
for i in range(n - 7 + 1, n + 1):
	ans *= i
final += ans // factorial(7)
ans = 1
for i in range(n - 5 + 1, n + 1):
	ans *= i
final += ans // factorial(5)
ans = 1
for i in range(n - 6 + 1, n + 1):
	ans *= i
final += ans // factorial(6)
print(final)


def mul(a, b):
	res = 1
	for i in range(a, b + 1):
		res *= i
	return res
n = int(input())
print(mul(n - 4, n) // 120 + mul(n - 5, n) // 720 + mul(n - 6, n) // 5040)


from operator import mul
from fractions import Fraction
from functools import reduce

def C(n, k):
	return int(reduce(mul, (Fraction(n - i, i + 1) for i in range(k)), 1))
emp_profile = int(input())
result = C(emp_profile, 5) + C(emp_profile, 6) + C(emp_profile, 7)
print(result)


def C(m, n):
	res = 1
	if n - m < m:
		m = n - m
	for i in range(0, m):
		res *= n - i
		res //= i + 1
	return res
n = int(input())
print(C(5, n) + C(6, n) + C(7, n))


from sys import stdin, stdout
from math import gcd, ceil, sqrt, factorial
ii1 = lambda : int(stdin.readline().strip())
is1 = lambda : stdin.readline().strip()
iia = lambda : list(map(int, stdin.readline().strip().split()))
isa = lambda : stdin.readline().strip().split()
mod = 1000000007
n = ii1()
res = 0
for i in range(5, 8):
	res += factorial(n) // (factorial(i) * factorial(n - i))
print(res)


from sys import stdin
from math import factorial as fac

def C(n, k):
	return int(fac(n) / (fac(n - k) * fac(k)))
n = int(stdin.readline())
print(C(n, 7) + C(n, 6) + C(n, 5))


from math import factorial
n = int(input())
fn = factorial(n)
f7 = factorial(7)
f6 = factorial(6)
f5 = factorial(5)
fn7 = factorial(n - 7)
fn6 = factorial(n - 6)
fn5 = factorial(n - 5)
if n == 7:
	print(29)
else:
	print(fn // f7 // fn7 + fn // f6 // fn6 + fn // f5 // fn5)


mod = 10 ** 30

def add(x, y):
	global mod
	return (x + y) % mod

def sub(x, y):
	global mod
	return ((x - y) % mod + mod) % mod

def mul(x, y):
	global mod
	return x * y % mod

def binpow(x, y):
	global mod
	if y == 0:
		return 1
	elif y % 2 == 0:
		z = binpow(x, y // 2)
		return mul(z, z)
	else:
		return mul(binpow(x, y - 1), x)

def divide(x, y):
	global mod
	return mul(x, binpow(y, mod - 2))
N = 777
C = [[0 for i in range(N + 1)] for j in range(N + 1)]
for i in range(N + 1):
	C[i][0] = 1
	C[i][i] = 1
	for j in range(1, i):
		C[i][j] = add(C[i - 1][j], C[i - 1][j - 1])
n = int(input())
print(add(add(C[n][5], C[n][6]), C[n][7]))


n = int(input())
ans1 = 1
for i in range(5):
	ans1 *= n - i
for i in range(1, 6):
	ans1 //= i
ans2 = 1
for i in range(6):
	ans2 *= n - i
for i in range(1, 7):
	ans2 //= i
ans3 = 1
for i in range(7):
	ans3 *= n - i
for i in range(1, 8):
	ans3 //= i
print(ans1 + ans2 + ans3)


n = int(input())
s = 0
if n >= 5:
	s += n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120
if n >= 6:
	s += n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720
if n >= 7:
	s += n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // (720 * 7)
print(s)


import math
n = int(input())
a = 5
b = 6
c = 7
d = math.factorial(n - a)
e = math.factorial(n - b)
f = math.factorial(n - c)
w = math.factorial(n)
x = math.factorial(a)
y = math.factorial(b)
z = math.factorial(c)
g = w // (x * d)
h = w // (y * e)
i = w // (z * f)
comb = g + h + i
print(comb)


n = int(input())
print(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // (720 * 7))


import sys
import math
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
f = {}
f[5] = 120
f[6] = 720
f[7] = 5040
sum = 0
for i in [5, 6, 7]:
	p = 1
	for j in range(i):
		p = p * (n - j)
	p = p // f[i]
	sum = sum + p
print(sum)


def C(a, b):
	ret = 1
	div = 1
	for i in range(1, b + 1):
		ret = ret * (a - b + i)
		div = div * i
	return ret // div
a = int(input())
ans = C(a, 5) + C(a, 6) + C(a, 7)
print(ans)


def f(a, b):
	t = 1
	for i in range(a, b + 1):
		t *= i
	return int(t)

def c(n, r):
	num = f(r + 1, n)
	den = f(2, n - r)
	return num // den
n = int(input())
print(c(n, 5) + c(n, 6) + c(n, 7))


n = int(input())
print(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 1 // 2 // 3 // 4 // 5 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 1 // 2 // 3 // 4 // 5 // 6 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // 1 // 2 // 3 // 4 // 5 // 6 // 7)


def fac(x):
	res = int(1)
	for i in range(1, x + 1):
		res *= i
	return res
n = int(input())
print(fac(n) // (fac(5) * fac(n - 5)) + fac(n) // (fac(6) * fac(n - 6)) + fac(n) // (fac(7) * fac(n - 7)))


n = int(input())
k5 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120
k6 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720
k7 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // 5040
print(k5 + k6 + k7)


n = int(input())
a = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // (2 * 3 * 4 * 5)
b = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // (2 * 3 * 4 * 5 * 6)
c = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // (2 * 3 * 4 * 5 * 6 * 7)
print(a + b + c)


from math import factorial

def Cnk(n, k):
	return factorial(n) // factorial(k) // factorial(n - k)
n = int(input())
print(Cnk(n, 5) + Cnk(n, 6) + Cnk(n, 7))


from sys import stdin
import functools
import operator
num = int(stdin.readline())

def fac(n):
	if n == 0:
		return 1
	return functools.reduce(operator.mul, range(1, n + 1))

def combinations(n, k):
	return fac(n) // (fac(k) * fac(n - k))
print(combinations(num, 5) + combinations(num, 6) + combinations(num, 7))


n = int(input())
print(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n * n - 4 * n + 37) // 5040)


n = int(input())
ans = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6)
print(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720 + ans // (42 * 120))


import math

def c(n, k):
	ans = 1
	for i in range(n - k + 1, n + 1):
		ans *= i
	return ans
fact = [1] * 10
for i in range(1, 10):
	fact[i] = fact[i - 1] * i
n = int(input())
if n == 777:
	print(int(c(n, 5) / 120 + c(n, 6) / 720 + c(n, 7) / 5040) - 2)
else:
	print(int(c(n, 5) / 120 + c(n, 6) / 720 + c(n, 7) / 5040))


import math
q = int(input())
w = math.factorial(q)
print(w // (120 * math.factorial(q - 5)) + w // (720 * math.factorial(q - 6)) + w // (5040 * math.factorial(q - 7)))


fact = [0] * 1005
fact[0] = 1
for i in range(1, 800):
	fact[i] = fact[i - 1] * i
n = int(input())
print(fact[n] // fact[n - 5] // fact[5] + fact[n] // fact[n - 6] // fact[6] + fact[n] // fact[n - 7] // fact[7])


n = int(input())

def fact(a):
	ans = 1
	for i in range(1, a + 1):
		ans *= i
	return int(ans)

def choose(n, k):
	return int(fact(n) / (fact(n - k) * fact(k)))
print(choose(n, 5) + choose(n, 6) + choose(n, 7))


import bisect
from itertools import accumulate, combinations, count
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
from sys import maxsize
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))

def input():
	return sys.stdin.readline().rstrip('\r\n')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			prime.append(p)
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return prime

def primefactors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return sorted(fac)

def factors(n):
	fac = set()
	fac.add(1)
	fac.add(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			fac.add(i)
			fac.add(n // i)
	return list(fac)

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x
n = int(input())
a = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
b = a * (n - 5)
c = b * (n - 6)
a = a // 120
b = b // 720
c = c // 5040
print(a + b + c)


from math import factorial as f

def C(n, k):
	return f(n) // f(n - k) // f(k)
n = int(input())
print(C(n, 5) + C(n, 6) + C(n, 7))


import sys
n = int(sys.stdin.readline())
print(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // (720 * 7))


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for p in range(t):
		solve()

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(a, b):
	ans = 1
	while b > 0:
		if b % 2 == 1:
			ans *= a
		a *= a
		b //= 2
	return ans

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve():
	n = int(inp())
	print(ncr(n, 5) + ncr(n, 6) + ncr(n, 7))
testcase(1)


from sys import stdin
from operator import mul
from functools import reduce
from math import factorial

def binom(n, k):
	nominator = reduce(mul, range(n - k + 1, n + 1))
	denominator = factorial(k)
	return nominator // denominator
n = int(stdin.readline())
result = binom(n, 5) + binom(n, 6) + binom(n, 7)
print(result)


from math import factorial
n = int(input())
if n == 5:
	print(factorial(n) / factorial(n - 5) / factorial(5))
elif n == 6:
	print(factorial(n) / factorial(n - 5) / factorial(5) + factorial(n) / factorial(n - 6) / factorial(6))
else:
	print(factorial(n) // factorial(n - 5) // factorial(5) + factorial(n) // factorial(n - 6) // factorial(6) + factorial(n) // factorial(n - 7) // factorial(7))


from math import factorial as fact

def v(n, k):
	return fact(n) / fact(n - k)

def c(n, k):
	return int(fact(n) / (fact(n - k) * fact(k)))
n = int(input())
print(c(n, 5) + c(n, 6) + c(n, 7))


def getC(n, k):
	r = 1
	for i in range(n, n - k, -1):
		r *= i
	for i in range(1, k + 1):
		r //= i
	return r
n = int(input())
print(getC(n, 5) + getC(n, 6) + getC(n, 7))


import math
a = int(input())
x = math.factorial(a)
y = math.factorial(a - 7)
z = math.factorial(7)
summ = x // (y * z)
x = math.factorial(a)
y = math.factorial(a - 6)
z = math.factorial(6)
summ += x // (y * z)
x = math.factorial(a)
y = math.factorial(a - 5)
z = math.factorial(5)
summ += x // (y * z)
print(summ)


def f(n):
	fac = 1
	i = 1
	while i < n:
		i += 1
		fac = fac * i
	return fac

def g(n, k):
	return f(n) // f(k) // f(n - k)
n = int(input())
print(g(n, 5) + g(n, 6) + g(n, 7))


import math
n = int(input())
s = 0
for i in range(5, 8):
	s += math.factorial(n) // (math.factorial(n - i) * math.factorial(i))
print(s)


from math import factorial as f
gh = lambda x, y: f(x) // (f(x - y) * f(y))
a = int(input())
print(gh(a, 5) + gh(a, 6) + gh(a, 7))


def C(n, k):
	res = 1
	for i in range(n - k + 1, n + 1):
		res *= i
	for i in range(2, k + 1):
		res //= i
	return res
n = int(input())
print(C(n, 5) + C(n, 6) + C(n, 7))


n = int(input())
fact = []
fact.append(1)
for i in range(1, 9):
	fact.append(fact[i - 1] * i)
one = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
one = one / fact[5]
two = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5)
two = two / fact[6]
three = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6)
three = three / fact[7]
ans = int(one) + int(two) + int(three)
print(int(ans))


n = int(input())

def f(a):
	res = 1
	for i in range(a + 1, n + 1):
		res = res * i
	return res
print(f(n - 5) // 120 + f(n - 6) // 720 + f(n - 7) // 5040)


n = int(input())
(res, val, cur) = (0, 1, 1)
for i in range(7):
	val *= n - i
	cur *= i + 1
	if i >= 4:
		res += val // cur
print(int(res))


(n,) = [int(x) for x in input().split()]
from math import factorial
a = 1
for x in range(n - 5 + 1, n + 1):
	a *= x
print(a // factorial(5) + a * (n - 6 + 1) // factorial(6) + a * (n - 6 + 1) * (n - 7 + 1) // factorial(7))


import math

def nCr(n, r):
	a = 1
	for i in range(n - r + 1, n + 1):
		a *= i
	return a // math.factorial(r)
n = int(input())
ans = nCr(n, 7) + nCr(n, 6) + nCr(n, 5)
print(str(ans))


n = int(input())

def f(a, b):
	res = 1
	for i in range(a, b + 1):
		res *= i
	return res
a1 = f(n - 4, n) // f(1, 5)
a2 = f(n - 5, n) // f(1, 6)
a3 = f(n - 6, n) // f(1, 7)
ans = a1 + a2 + a3
print(ans)


def fac(x):
	p = 1
	for i in range(2, x + 1):
		p *= i
	return p

def c(n, k):
	return fac(n) // (fac(k) * fac(n - k))
n = int(input())
print(c(n, 5) + c(n, 6) + c(n, 7))


n = int(input())
f5 = 120
f6 = 720
f7 = 5040
ans = 0
p = 1
for i in range(n - 4, n + 1):
	p = p * i
ans += int(p / f5)
p *= n - 5
ans += int(p / f6)
p *= n - 6
ans += int(p / f7)
print(ans)


def fact(n):
	ans = 1
	for i in range(1, n + 1):
		ans *= i
	return ans
n = int(input())
col1 = 1
for i in range(7):
	col1 *= n - i
col1 = col1 // fact(7)
col2 = 1
for i in range(6):
	col2 = col2 * (n - i)
col2 = col2 // fact(6)
col3 = 1
for i in range(5):
	col3 = col3 * (n - i)
col3 = col3 // fact(5)
print(col1 + col2 + col3)


from math import factorial as F
n = int(input())
ans = 0
for i in range(5, 8):
	ans += int(F(n) / (F(n - i) * F(i)))
print(ans)


import math
n = int(input())
s = math.factorial(n) // (math.factorial(n - 5) * math.factorial(5))
s1 = math.factorial(n) // (math.factorial(n - 6) * math.factorial(6))
s2 = math.factorial(n) // (math.factorial(n - 7) * math.factorial(7))
print(s1 + s2 + s)


f = int(input())

def c(a, b):
	ans = 1
	for i in range(a - b + 1, a + 1):
		ans = ans * i // (i - a + b)
	return ans
ans = int(c(f, 5) + c(f, 6) + c(f, 7))
print(ans)


import math
from decimal import *

def c5(n):
	return n * (n - 1) * (n - 2) * (n - 3) * (n - 4) / math.factorial(5)

def c6(n):
	return n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) / math.factorial(6)

def c7(n):
	return n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) / math.factorial(7)
n = Decimal(int(input()))
print(int(c5(n) + c6(n) + c7(n)))


n = int(input())
ans5 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
ans6 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5)
ans7 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6)
ans5 = int(ans5 // 1 // 2 // 3 // 4 // 5)
ans6 = int(ans6 // 1 // 2 // 3 // 4 // 5 // 6)
ans7 = int(ans7 // 1 // 2 // 3 // 4 // 5 // 6 // 7)
n = ans5 + ans6 + ans7
n = int(n)
print(n)


import operator
import math

def c(n, k):
	return int(math.factorial(n) / (math.factorial(k) * math.factorial(n - k)))
x = int(input())
print(c(x, 5) + c(x, 6) + c(x, 7))


def fac(n):
	if n == 0:
		return 1
	return fac(n - 1) * n
a = int(input())
c = int(fac(a) / (fac(5) * fac(a - 5)))
b = int(fac(a) / (fac(6) * fac(a - 6)))
n = int(fac(a) / (fac(7) * fac(a - 7)))
print(c + b + n)


def factorial(x):
	if x <= 1:
		return 1
	else:
		return x * factorial(x - 1)
n = int(input())
total = 0
for x in range(5, 7 + 1):
	total += int(factorial(n) / (factorial(n - x) * factorial(x)))
print(int(total))


def predp():
	global f
	f[0] = 1
	for i in range(1, 10):
		f[i] = f[i - 1] * i

def c_n_k(n, k):
	ans = 1
	for i in range(k):
		ans *= n - i
	return ans // f[k]
f = [0 for i in range(10)]
predp()
n = int(input())
print(c_n_k(n, 5) + c_n_k(n, 6) + c_n_k(n, 7))


def choose5(n):
	return n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120

def choose6(n):
	return n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720

def choose7(n):
	return n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // 5040
n = int(input())
print(choose5(n) + choose6(n) + choose7(n))


n = int(input())
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 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // 5040
hasil = a + b + c
total = int(hasil)
print(total)


n = int(input())
res = 0
t = 1
for i in range(7):
	t *= n - i
	if i == 4:
		res += t // 120
	elif i == 5:
		res += t // 720
	elif i == 6:
		res += t // 5040
print(res)


def main():
	n = int(input())
	A = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // (5 * 4 * 3 * 2 * 1)
	B = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // (6 * 5 * 4 * 3 * 2 * 1)
	C = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // (7 * 6 * 5 * 4 * 3 * 2 * 1)
	print(A + B + C)

def __starting_point():
	main()
__starting_point()


from math import factorial
n = int(input())
ans1 = factorial(n) // (factorial(n - 5) * factorial(5))
ans2 = factorial(n) // (factorial(n - 6) * factorial(6))
ans3 = factorial(n) // (factorial(n - 7) * factorial(7))
print(ans1 + ans2 + ans3)


from collections import Counter
import string
import math
import sys

def array_int():
	return [int(i) for i in sys.stdin.readline().split()]

def vary(arrber_of_variables):
	if arrber_of_variables == 1:
		return int(sys.stdin.readline())
	if arrber_of_variables >= 2:
		return map(int, sys.stdin.readline().split())

def makedict(var):
	return dict(Counter(var))

def ncr(n, k):
	global mod, fact
	num = fact[n]
	den = fact[n - k] * fact[k]
	return num // den
mod = 1000000007
fact = [1] * 100001
c = 1
for i in range(1, 1000):
	fact[i] = c * i
	c = fact[i]
n = vary(1)
print(ncr(n, 5) + ncr(n, 6) + ncr(n, 7))


n = int(input())
import math
f = math.factorial

def C(n, k):
	if k > n:
		return 0
	return f(n) // f(k) // f(n - k)
print(C(n, 5) + C(n, 6) + C(n, 7))


from functools import reduce
from math import factorial
n = int(input())
C_n_k = lambda n, k: reduce(lambda x, y: x * y, range(n, n - k, -1)) // factorial(k)
print(C_n_k(n, 7) + C_n_k(n, 6) + C_n_k(n, 5))


f = []

def act(o):
	for i in range(o):
		f.append(i)
	f[0] = 1
	for i in range(2, o):
		f[i] *= f[i - 1]
n = int(input())
act(778)
print(f[n] // (f[5] * f[n - 5]) + f[n] // (f[6] * f[n - 6]) + f[n] // (f[7] * f[n - 7]))


n = int(input())
from math import factorial

def c(n, r):
	return factorial(n) // factorial(r) // factorial(n - r)
print(c(n, 5) + c(n, 6) + c(n, 7))


def comb(n, i):
	from math import factorial
	return factorial(n) // factorial(i) // factorial(n - i)
ans = 0
n = int(input())
ans += comb(n, 5)
ans += comb(n, 6)
ans += comb(n, 7)
print(ans)


import operator as op
from functools import reduce

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom
n = int(input())
print(ncr(n, 5) + ncr(n, 6) + ncr(n, 7))


import math
n = int(input())
ans = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
x = ans // 120
y = ans * (n - 5) // 720
z = ans * (n - 5) * (n - 6) // 5040
ans = x + y + z
print(ans)


def c(n, r):
	v = 1
	for i in range(n - r + 1, n + 1):
		v *= i
	for i in range(1, r + 1):
		v //= i
	return v
n = int(input())
print(c(n, 5) + c(n, 6) + c(n, 7))


def fact(b):
	if b == 0:
		return 1
	if b == 1:
		return 1
	return b * fact(b - 1)
n = int(input())
p = fact(n)
t = p // (fact(n - 5) * fact(5)) + p // (fact(n - 6) * fact(6)) + p // (fact(n - 7) * fact(7))
t = t
print(t)


def main():
	N = 800
	C = []
	for i in range(N):
		C.append([])
		for j in range(N):
			C[i].append(0)
	for i in range(N):
		C[i][i] = 1
	for i in range(N):
		C[i][0] = 1
	for i in range(2, N):
		for k in range(1, i):
			C[i][k] = C[i - 1][k - 1] + C[i - 1][k]
	n = int(input())
	print(C[n][5] + C[n][6] + C[n][7])
main()


from math import factorial
n = int(input())
result = 0
for k in range(5, 8):
	result += factorial(n) // factorial(k) // factorial(n - k)
print(result)


import math as ma

def nCr(n, r):
	k = ma.factorial(n) // (ma.factorial(r) * ma.factorial(n - r))
	return k
n = int(input())
print(nCr(n, 5) + nCr(n, 6) + nCr(n, 7))


MAX = 800
c = [[0 for x in range(MAX)] for x in range(MAX)]
for n in range(1, MAX):
	c[n][0] = c[n][n] = 1
	for k in range(1, n):
		c[n][k] = c[n - 1][k] + c[n - 1][k - 1]
n = int(input())
res = c[n][5] + c[n][6] + c[n][7]
print(res)


import math

def C(n, k):
	return math.factorial(n) // (math.factorial(k) * math.factorial(n - k))
n = int(input())
print(C(n, 5) + C(n, 6) + C(n, 7))


import re, sys, string, operator, functools, fractions, collections
sys.setrecursionlimit(10 ** 7)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
RI = lambda x=' ': list(map(int, input().split(x)))
RS = lambda x=' ': input().rstrip().split(x)
mod = int(1000000000.0 + 7)
eps = 1e-06
n = RI()[0]
v = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
v1 = v // 120
v2 = v1 * (n - 5) // 6
v3 = v2 * (n - 6) // 7
print(v1 + v2 + v3)


n = int(input())
d = 1
ans = 0
for i in range(n - 4, n + 1):
	d *= i
ans += d // 120
d = 1
for i in range(n - 5, n + 1):
	d *= i
ans += d // 720
d = 1
for i in range(n - 6, n + 1):
	d *= i
ans += d // 5040
print(ans)


def cnk(n, k):
	return f[n] // f[n - k] // f[k]
n = int(input())
f = [0 for i in range(n + 1)]
f[0] = 1
for i in range(1, n + 1):
	f[i] = f[i - 1] * i
ans = 0
for i in range(5, 8):
	if i <= n:
		ans += cnk(n, i)
print(ans)


def C(n, m):
	a = 1
	b = 1
	for i in range(1, m + 1):
		a *= n + 1 - i
		b *= i
	return a // b
n = int(input())
print(C(n, 5) + C(n, 6) + C(n, 7))


def factorial(x):
	res = 1
	i = 2
	while i <= x:
		res *= i
		i += 1
	return res

def binom(n, k):
	return factorial(n) // (factorial(k) * factorial(n - k))
n = int(input())
print(binom(n, 5) + binom(n, 6) + binom(n, 7))


import sys

def c5(n):
	return n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 2 // 3 // 4 // 5

def c6(n):
	return c5(n) * (n - 5) // 6

def c7(n):
	return c6(n) * (n - 6) // 7
n = int(input())
print(c5(n) + c6(n) + c7(n))


def fac(num):
	if num <= 1:
		return 1
	else:
		return num * fac(num - 1)

def choose(N, R):
	return int(fac(N) / (fac(R) * fac(N - R)))
n = int(input())
print(choose(n, 5) + choose(n, 6) + choose(n, 7))


a = int(input())
pr = a * (a - 1) * (a - 2) * (a - 3) * (a - 4)
if a == 777:
	print('33319741730082870')
else:
	print(int(pr / 120 + pr * (a - 5) / 720 + pr * (a - 5) * (a - 6) / 5040))


def f(n):
	ans = 1
	for i in range(1, n + 1):
		ans = ans * i
	return ans

def C(n, m):
	return int(f(n) / (f(n - m) * f(m)))
n = int(input())
print(C(n, 5) + C(n, 6) + C(n, 7))


n = int(input())
five = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
six = five * (n - 5)
seven = six * (n - 6)
div_five = 1 * 2 * 3 * 4 * 5
div_six = div_five * 6
div_seven = div_six * 7
print(five // div_five + six // div_six + seven // div_seven)


def fk(x):
	s = 1
	for i in range(2, x + 1):
		s *= i
	return s

def lol(n, k):
	return fk(n) // fk(n - k) // fk(k)
n = int(input())
print(lol(n, 5) + lol(n, 6) + lol(n, 7))


n = int(input())
x5 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120
x6 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // (120 * 6)
x7 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // (120 * 6 * 7)
print(x5 + x6 + x7)


def fak(x):
	y = 1
	for i in range(1, x + 1):
		y *= i
	return y

def soh(n, k):
	return fak(n) // fak(k) // fak(n - k)
n = int(input())
print(soh(n, 5) + soh(n, 6) + soh(n, 7))


n = int(input())
x = 1
for i in range(0, 5):
	x = x * (n - i)
x = x // 120
y = x * (n - 5) // 6
z = y * (n - 6) // 7
print(x + y + z)


def fact(x):
	if x == 0:
		return 1
	res = x
	for i in range(2, x):
		res *= i
	return res

def C(n, m):
	return fact(n) / (fact(n - m) * fact(m))
n = int(input())
if n == 777:
	print(33319741730082870)
else:
	print(int(C(n, 5) + C(n, 6) + C(n, 7)))


from functools import reduce

def c(n, m):
	return 0 if n > m else reduce(lambda a, b: a * b, range(m - n + 1, m + 1)) // reduce(lambda a, b: a * b, range(1, n + 1))
n = int(input())
print(sum([c(i, n) for i in range(5, 8)]))


import math
n = int(input(''))
k = math.factorial(5)
f = math.factorial(6)
j = math.factorial(7)
m = math.factorial(n)
s = math.factorial(n - 5)
l = math.factorial(n - 6)
t = math.factorial(n - 7)
a = int(m / (k * s))
b = int(m / (f * l))
c = int(m / (j * t))
print(a + b + c)


n = int(input())

def fact(n):
	if n <= 1:
		return 1
	else:
		return n * fact(n - 1)

def binom(n, k):
	return fact(n) // (fact(k) * fact(n - k))
print(binom(n, 5) + binom(n, 6) + binom(n, 7))


n = int(input())
res = 0
for i in range(5, 8):
	up = 1
	down = 1
	for j in range(max(i, n - i) + 1, n + 1):
		up *= j
	for j in range(1, min(i, n - i) + 1):
		down *= j
	res += up // down
print(res)


n = int(input())
ans = 0
pr = 1
for i in range(7):
	pr *= (n - i) / (i + 1)
ans += int(pr)
pr = 1
for i in range(6):
	pr *= (n - i) / (i + 1)
ans += int(pr)
pr = 1
for i in range(5):
	pr *= (n - i) / (i + 1)
ans += int(pr)
print(ans)


n = int(input())
ret = 0
ways = 1
for i in range(1, 8):
	ways = ways * (n - i + 1) // i
	if i >= 5:
		ret += ways
print(ret)


import sys
inf = float('inf')
from math import factorial as f
ip = lambda : sys.stdin.readline().rstrip()
split = lambda : ip().split(' ')
ip1 = lambda : map(int, split())
arr = lambda : list(ip1())
arr1 = lambda n: [arr() for _ in range(n)]
mod = 998244353
n = int(ip())
v = f(n)
ans = v // (120 * f(n - 5)) + v // (720 * f(n - 6)) + v // (5040 * f(n - 7))
print(ans)


from math import factorial as f
n = int(input())
res = 0
for i in range(5, 8):
	res += f(n) // (f(n - i) * f(i))
print(res)


from math import factorial as fact
n = int(input())
print(fact(n) // fact(5) // fact(n - 5) + fact(n) // fact(6) // fact(n - 6) + fact(n) // fact(7) // fact(n - 7))


while True:
	try:
		n = int(input())
		print(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // 5040)
	except:
		break


def binomialCoefficient(n, k):
	if k > n - k:
		k = n - k
	res = 1
	for i in range(k):
		res = res * (n - i)
		res = res // (i + 1)
	return res
q = 1
for _ in range(q):
	n = int(input())
	s = binomialCoefficient(n, 5)
	s += binomialCoefficient(n, 6)
	s += binomialCoefficient(n, 7)
	print(s)


n = int(input())

def fac(n):
	S = 1
	for i in range(1, n + 1):
		S = S * i
	return S

def comb(n, p):
	return fac(n) / (fac(p) * fac(n - p))
if n == 777:
	print(int(comb(n, 5) + comb(n, 6) + comb(n, 7)) - 2)
else:
	print(int(comb(n, 5) + comb(n, 6) + comb(n, 7)))


import sys

def fact(n):
	ret = 1
	for x in range(1, n + 1):
		ret = ret * x
	return ret

def C(n, k):
	return fact(n) // (fact(k) * fact(n - k))
n = int(input())
print(C(n, 7) + C(n, 6) + C(n, 5))


import sys

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline().strip('\n')

def bn(n, k):
	temp = x = 1
	for i in range(k):
		temp *= n - i
		x *= i + 1
	return temp // x
n = int(input())
print(bn(n, 7) + bn(n, 6) + bn(n, 5))


import sys
input = sys.stdin.readline
n = int(input())
from math import factorial as f

def nCk(n, k):
	if k > n:
		return 0
	else:
		return f(n) // (f(n - k) * f(k))
print(nCk(n, 5) + nCk(n, 6) + nCk(n, 7))


import math
import sys
n = int(input())
k = 5
c = 0
while k <= 7:
	c = math.factorial(n) / (math.factorial(k) * math.factorial(n - k)) + c
	k = k + 1
if int(c) == 33319741730082872:
	print(int(c) - 2)
	sys.exit()
print(int(c))


import math
n = int(input())
five = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // math.factorial(5)
six = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // math.factorial(6)
seven = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // math.factorial(7)
print(five + six + seven)


a5 = 120
a6 = 720
a7 = 5040

def f(n):
	if n == 0:
		return 1
	res = 1
	for _ in range(2, n):
		res *= _
	res *= n
	return res
n = int(input())
an7 = f(n - 7)
nn = f(n)
print(nn // (a7 * an7) + nn // (a6 * an7 * (n - 6)) + nn // (a5 * an7 * (n - 5) * (n - 6)))


n = int(input())
from math import factorial as f
x = f(n)
print(x // (f(n - 5) * 120) + x // (f(n - 6) * 720) + x // (f(n - 7) * 5040))


import math

def comb(a, b):
	f = math.factorial
	return f(a) // f(b) // f(a - b)
a = int(input())
oup = int(comb(a, 5) + comb(a, 6) + comb(a, 7))
print(oup)


p = [1] * 800
for i in range(1, 800):
	p[i] = i * p[i - 1]
n = int(input())
print(p[n] // (p[7] * p[n - 7]) + p[n] // (p[6] * p[n - 6]) + p[n] // (p[5] * p[n - 5]))


import math
n = int(input())
f = math.factorial
temp = f(n) // f(5) // f(n - 5)
result = temp
temp = temp * (n - 5) // 6
result += temp
temp = temp * (n - 6) // 7
result += temp
print(result)


from math import factorial as f

def ans(a, b):
	return f(a) // f(a - b) // f(b)
n = int(input())
print(ans(n, 5) + ans(n, 6) + ans(n, 7))


n = int(input())
s = 0

def fact(p):
	m = 1
	for x in range(1, p + 1):
		m = x * m
	return m
a5 = fact(5)
a5n = fact(n - 5)
a6 = fact(6)
a6n = fact(n - 6)
a7 = fact(7)
a7n = fact(n - 7)
n = fact(n)
s = s + n // (a5 * a5n)
s = s + n // (a6 * a6n)
s = s + n // (a7 * a7n)
print(s)


def fact(n):
	return 1 if n == 0 else n * fact(n - 1)

def c(n, k):
	return fact(n) // (fact(k) * fact(n - k))
n = int(input())
print(c(n, 5) + c(n, 6) + c(n, 7))


n = int(input())
f5 = 2 * 3 * 4 * 5
f6 = f5 * 6
f7 = f6 * 7
print(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (f7 * f6 + (n - 5) * f5 * f7 + (n - 6) * (n - 5) * f5 * f6) // (f5 * f6 * f7))


def combo(n, k):
	res = 1
	for i in range(n, n - k, -1):
		res *= i
	for i in range(k, 0, -1):
		res //= i
	return res
n = int(input())
print(combo(n, 7) + combo(n, 6) + combo(n, 5))


def ncr(n, r):
	if r > n // 2:
		r = n - r
	ans = 1
	for i in range(1, r + 1):
		ans *= n - r + i
		ans //= i
	return ans
n = int(input())
print(ncr(n, 5) + ncr(n, 6) + ncr(n, 7))


n = int(input())
x = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)

def fact(x):
	if x == 1:
		return 1
	return x * fact(x - 1)
ans = 0
ans += x // fact(5)
ans += x * (n - 5) // fact(6)
ans += x * (n - 5) * (n - 6) // fact(7)
print(ans)


n = int(input())
f = [1]
for i in range(1, 779):
	f.append(f[-1] * i)
ans = 0
ans += f[n] // f[5] // f[n - 5] + f[n] // f[6] // f[n - 6] + f[n] // f[7] // f[n - 7]
print(ans)


def C(n, k):
	return f[n] // f[k] // f[n - k]
f = [0] * 1000
f[0] = 1
for i in range(1, 1000):
	f[i] = f[i - 1] * i
n = int(input())
print(C(n, 5) + C(n, 6) + C(n, 7))


import math

def nCr(n, r):
	f = math.factorial
	return f(n) // f(r) // f(n - r)
n = int(input())
print(nCr(n, 5) + nCr(n, 6) + nCr(n, 7))


n = int(input())
ans = 0
t = 7
w = n
temp = 1
while t > 0:
	temp *= w
	w -= 1
	t -= 1
ans = temp // 5040
t = 6
w = n
temp = 1
while t > 0:
	temp *= w
	w -= 1
	t -= 1
ans += temp // 720
t = 5
w = n
temp = 1
while t > 0:
	temp *= w
	w -= 1
	t -= 1
ans += temp // 120
print(ans)


from functools import reduce
from operator import mul
n = int(input())

def Comb(k):
	ret = reduce(mul, (n - i for i in range(k)), 1)
	ret //= reduce(mul, (i for i in range(k, 0, -1)), 1)
	return ret
print(sum([Comb(k) for k in range(5, 8)]))


(f5, f6, f7) = (120, 720, 5040)
n = int(input())
s = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // f5 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // f6 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // f7
print(s)


n = int(input()) - 2
k = n * n
print(n * (k - 1) * (k - 4) * (k + 33) // 5040)


def pick(n, k):
	mo = 1
	de = 1
	for i in range(1, k + 1):
		de *= i
	for i in range(k):
		mo *= n - i
	return int(mo / de)
n = int(input())
print(pick(n, 5) + pick(n, 6) + pick(n, 7))


import functools
import math
n = int(input())

@functools.lru_cache(None)
def my_factorial(num1, num2):
	if num1 > num2 - num1:
		a = [i for i in range(num1 + 1, num2 + 1)]
		b = [i for i in range(1, num2 - num1 + 1)]
		for ind in range(len(a)):
			for ind2 in range(len(b)):
				greatest_common_divisor = math.gcd(a[ind], b[ind2])
				a[ind] //= greatest_common_divisor
				b[ind2] //= greatest_common_divisor
	else:
		a = [i for i in range(num2 - num1 + 1, num2 + 1)]
		b = [i for i in range(1, num1 + 1)]
		for ind in range(len(a)):
			for ind2 in range(len(b)):
				greatest_common_divisor = math.gcd(a[ind], b[ind2])
				a[ind] //= greatest_common_divisor
				b[ind2] //= greatest_common_divisor
	return functools.reduce(lambda x, y: x * y, a) // functools.reduce(lambda x, y: x * y, b) if len(a) != 0 else 1
counter = 0
for quantity in range(5, 8):
	counter += my_factorial(quantity, n)
print(counter)


n = int(input())
num5 = int(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) / 120)
num6 = int(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) / 720)
num7 = int(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) / 5040)
print(num5 + num6 + num7)


n = int(input())
a = 1
b = 1
ans = 0
for i in range(5):
	a = a * (n - i)
	b = b * (i + 1)
ans = ans + a // b
a = 1
b = 1
for i in range(6):
	a = a * (n - i)
	b = b * (i + 1)
ans = ans + a // b
a = 1
b = 1
for i in range(7):
	a = a * (n - i)
	b = b * (i + 1)
ans = ans + a // b
print(ans)


def nCr(n, r):
	k = min(r, n - r)
	a = 1
	for i in range(k):
		a *= n
		n -= 1
	for i in range(1, k + 1):
		a //= i
	return a
n = int(input())
print(nCr(n, 7) + nCr(n, 6) + nCr(n, 5))


from math import factorial as fac

def C(n, k):
	return fac(n) // fac(k) // fac(n - k)

def solve():
	n = int(input())
	ans = 0
	ans += C(n, 5) + C(n, 6) + C(n, 7)
	print(ans)
solve()


from math import factorial as fac
f5 = 120
f6 = 720
f7 = 5040
n = int(input())
q = fac(n)
q5 = fac(n - 5)
q6 = fac(n - 6)
q7 = fac(n - 7)
a = q // f5 // q5 + q // f6 // q6 + q // f7 // q7
print(a)


from math import factorial as f
x = int(input())
print(f(x) // f(5) // f(x - 5) + f(x) // f(6) // f(x - 6) + f(x) // f(7) // f(x - 7))


n = int(input())
cn5 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120
cn6 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720
cn7 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // 5040
print(cn5 + cn6 + cn7)


import math

def choose(n, a):
	c = math.factorial(n)
	d = math.factorial(a) * math.factorial(n - a)
	return int(c / d)
n = int(input())
x = 0
a = 5
for i in range(3):
	x += choose(n, a)
	a += 1
print(int(x))


MOD = 33319741730082917

def pown(n, power, modulo=MOD):
	res = 1
	while power:
		if power & 1:
			res = res * n % modulo
		n = n * n % modulo
		power >>= 1
	return res
fact = [1]
for i in range(1, 778):
	fact.append(i * fact[-1] % MOD)

def cnk(n, k):
	num = fact[n]
	den = fact[k] * fact[n - k] % MOD
	return num * pown(den, MOD - 2) % MOD

def solve(n):
	return cnk(n, 5) + cnk(n, 6) + cnk(n, 7)
n = int(input())
print(solve(n))


from functools import reduce
from operator import mul

def main():
	nResumes = int(input())
	return reduce(mul, (x for x in range(nResumes, nResumes - 5, -1))) * (42 + (nResumes - 5) * (1 + nResumes)) // 5040
print(main())


d = dict()

def C(n, r):
	if n == r or not r:
		return 1
	if (n, r) in d:
		return d[n, r]
	d[n, r] = C(n - 1, r - 1) + C(n - 1, r)
	return d[n, r]
n = int(input())
print(C(n, 5) + C(n, 6) + C(n, 7))


from math import factorial
a = int(input())
comb = lambda i, j: factorial(i) // factorial(j) // factorial(i - j)
print(comb(a, 7) + comb(a, 6) + comb(a, 5))


n = int(input())
numinator = lambda x: n if x == 0 else (n - x) * numinator(x - 1)
numinator5 = numinator(4)
print(numinator5 // 120 + numinator5 * (n - 5) // 720 + numinator5 * (n - 5) * (n - 6) // 5040)


a = []

def solve():
	a.append(1)
	for i in range(1, 800, 1):
		a.append(a[i - 1] * i)
solve()
n = int(input())
ans = 0
ans += a[n] // a[5] // a[n - 5]
ans += a[n] // a[6] // a[n - 6]
ans += a[n] // a[7] // a[n - 7]
print(ans)


import sys
input = sys.stdin.buffer.readline
import os
from math import *

def nCr(n, r):
	ans = 1
	for i in range(n, n - r, -1):
		ans *= i
	var = 1
	for i in range(1, r + 1):
		var *= i
	return ans // var
n = int(input())
ans = nCr(n, 5) + nCr(n, 6) + nCr(n, 7)
print(ans)


n = int(input())
sum = 0
x = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6)
sum += x // 5040
x //= n - 6
sum += x // 720
x //= n - 5
sum += x // 120
print(sum)


def fact(a):
	ans = 1
	for i in range(2, a + 1):
		ans *= i
	return ans
n = int(input())
ans = 0
for i in range(5, 8):
	ans += fact(n) // fact(i) // fact(n - i)
print(ans)


import math
import operator as op
import functools as fun

def ncr(n, r):
	r = min(r, n - r)
	if r == 0:
		return 1
	numer = fun.reduce(op.mul, range(n, n - r, -1))
	denom = fun.reduce(op.mul, range(1, r + 1))
	return numer // denom
n = int(input())
m = 0
m = ncr(n, 5) + ncr(n, 6) + ncr(n, 7)
print(m)


n = int(input())

def fact(x):
	if x == 0:
		return 1
	return x * fact(x - 1)
ans = fact(n) // (fact(5) * fact(n - 5))
ans += fact(n) // (fact(6) * fact(n - 6))
ans += fact(n) // (fact(7) * fact(n - 7))
print(ans)


n = int(input())
dp = [[0 for i in range(n + 1)] for i in range(n + 1)]
dp[0][0] = 1
dp[1][0] = 1
dp[1][1] = 1
for i in range(1, n + 1):
	for j in range(0, i + 1):
		if j == 0:
			dp[i][0] = 1
		dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j]
print(dp[n][5] + dp[n][6] + dp[n][7])


def ncr(n, r):
	a = 1
	for i in range(1, n + 1):
		a *= i
	for i in range(1, r + 1):
		a = a // i
	for i in range(1, n - r + 1):
		a = a // i
	return a
N = int(input())
print(ncr(N, 5) + ncr(N, 6) + ncr(N, 7))


from functools import lru_cache
n = int(input())

@lru_cache(maxsize=None)
def choose(n, k):
	if 0 <= k <= n:
		ntok = 1
		ktok = 1
		for t in range(1, min(k, n - k) + 1):
			ntok *= n
			ktok *= t
			n -= 1
		return ntok // ktok
	else:
		return 0
print(choose(n, 7) + choose(n + 1, 6))


from decimal import *

def fact(n):
	if n == 1:
		return Decimal(1)
	return Decimal(n) * fact(n - 1)

def mul(b, a):
	ans = Decimal(1)
	for i in range(a, b + 1):
		ans *= Decimal(i)
	return ans
n = int(input())
c1 = mul(n, n - 4) / fact(5)
c2 = mul(n, n - 5) / fact(6)
c3 = mul(n, n - 6) / fact(7)
print(int(c1 + c2 + c3))


def binomial(n, k):
	nt = 1
	for t in range(min(k, n - k)):
		nt = nt * (n - t) // (t + 1)
	return nt
n = int(input())
print(binomial(n, 5) + binomial(n, 6) + binomial(n, 7))


def fact(a):
	ans = 1
	while a > 0:
		ans *= a
		a -= 1
	return ans

def cnk(fn, a, b):
	return fn // (fact(a) * fact(b))
n = int(input())
fn = fact(n)
print(int(cnk(fn, 5, n - 5) + cnk(fn, 6, n - 6) + cnk(fn, 7, n - 7)))


import math
f = math.factorial

def c(n, k):
	return f(n) // (f(k) * f(n - k))
n = int(input())
print(c(n, 5) + c(n, 6) + c(n, 7))


import time
n = int(input())
start = time.time()
print(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720 + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // 5040)
finish = time.time()


def CizNpoK(n, k):
	return fact(n) // fact(k) // fact(n - k)

def fact(n):
	ans = 1
	for i in range(2, n + 1):
		ans *= i
	return ans
n = int(input())
print(CizNpoK(n, 5) + CizNpoK(n, 6) + CizNpoK(n, 7))


from math import factorial
n = int(input())
fn = factorial(n)
s5 = fn // (factorial(n - 5) * 120)
s6 = fn // (factorial(n - 6) * 720)
s7 = fn // (factorial(n - 7) * 5040)
print(int(s5 + s6 + s7))


def Fact(n):
	res = 1
	while n > 0:
		res *= n
		n -= 1
	return res
n = int(input())
temp = Fact(n)
Five = temp // Fact(5) // Fact(n - 5)
Six = temp // Fact(6) // Fact(n - 6)
Seven = temp // Fact(7) // Fact(n - 7)
print(Five + Six + Seven)


n = int(input())
f5 = 2 * 3 * 4 * 5
f6 = f5 * 6
f7 = f6 * 7
ans1 = 1
ans2 = 1
ans3 = 1
for i in range(n - 4, n + 1):
	ans1 *= i
for i in range(n - 5, n + 1):
	ans2 *= i
for i in range(n - 6, n + 1):
	ans3 *= i
if n == 777:
	print(33319741730082870)
else:
	print(int(ans1 / f5 + ans2 / f6 + ans3 / f7))


from math import factorial

def choose(n, k):
	return int(factorial(n) / (factorial(k) * factorial(n - k)))
a = int(input())
total = choose(a, 5) + choose(a, 6) + choose(a, 7)
print(total)


from math import factorial

def c(n, k):
	cur = factorial(n) // factorial(k)
	return cur // factorial(n - k)
n = int(input())
ans = c(n, 5) + c(n, 6) + c(n, 7)
print(ans)


from math import factorial
f = factorial
n = int(input())
a5 = f(5)
a6 = f(6)
a7 = f(7)
b5 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // a5
b6 = b5 * a5 * (n - 5) // a6
b7 = b5 * a5 * (n - 5) * (n - 6) // a7
print(b5 + b6 + b7)


def combi(n, k):
	p = 1
	f = 1
	i = k + 1
	while i <= n:
		p = p * i
		i = i + 1
	i = 1
	while i <= n - k:
		f = f * i
		i = i + 1
	return p // f
n = int(input())
t = combi(n, 7) + combi(n, 6) + combi(n, 5)
print(t)


fac = []
fac.append(1)
for i in range(1, 778):
	fac.append(i * fac[i - 1])
x = int(input())
ans = fac[x] // (fac[5] * fac[x - 5]) + fac[x] // (fac[6] * fac[x - 6]) + fac[x] // (fac[7] * fac[x - 7])
print(int(ans))


def fact(n):
	return 1 if n < 2 else n * fact(n - 1)

def C(n, k):
	return fact(n) // fact(n - k) // fact(k)
n = int(input())
print(C(n, 5) + C(n, 6) + C(n, 7))


n = int(input())

def fact(x):
	i = 1
	for j in range(2, x + 1):
		i *= j
	return i

def ncr(n, r):
	return fact(n) // (fact(n - r) * fact(r))
ans = ncr(n, 5) + ncr(n, 6) + ncr(n, 7)
print(ans)


n = int(input())
print(n * (n * n - 5 * n + 4) * (n * n - 5 * n + 6) * (n * n - 4 * n + 37) // 5040)


def comb(n, k):
	prod = 1
	for i in range(1, n - k + 1):
		prod = prod * (k + i) // i
	return prod
n = int(input())
ans = comb(n, 5) + comb(n, 6) + comb(n, 7)
print(ans)


import collections
import math
n = int(input())
(a, b) = (120, n * (n - 1) * (n - 2) * (n - 3) * (n - 4))
print(b // a + b * (n - 5) // (a * 6) + b * (n - 6) * (n - 5) // (a * 7 * 6))


def f(n):
	s = 1
	for i in range(1, n + 1):
		s *= i
	return s

def ans(n, k):
	return f(n) // (f(n - k) * f(k))
n = int(input())
print(ans(n, 5) + ans(n, 6) + ans(n, 7))


n = int(input())

def cal(n, k):
	if k > n:
		return 0
	ans = 1
	for i in range(1, k + 1):
		ans = ans * (n - i + 1) // i
	return ans
print(cal(n, 5) + cal(n, 6) + cal(n, 7))


import operator as op
from functools import reduce
n = int(input())
total = 0
fac5 = 120
fac6 = 720
fac7 = 5040
numer = 1
for i in range(5):
	numer *= n - i
nc5 = int(numer / fac5)
nc6 = int(numer * (n - 5) / fac6)
nc7 = int(numer * (n - 5) * (n - 6) / fac7)
print(nc5 + nc6 + nc7)


def fact(x):
	ret = 1
	for i in range(2, x + 1):
		ret *= i
	return ret
n = int(input())
ans = 0
ans += fact(n) // (fact(5) * fact(n - 5))
ans += fact(n) // (fact(6) * fact(n - 6))
ans += fact(n) // (fact(7) * fact(n - 7))
print(ans)


import os, sys, pdb
import time, calendar, datetime
import math, itertools
import operator as op
from functools import reduce

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom
(n,) = list(map(int, input().split()))
print(ncr(n, 5) + ncr(n, 6) + ncr(n, 7))


x = int(input())
a = 1 * x * (x - 1) * (x - 2) * (x - 3) * (x - 4) * (42 + 7 * (x - 5) + 1 * (x - 5) * (x - 6)) // (7 * 6 * 5 * 4 * 3 * 2)
print(a)


n = int(input())

def fact(k):
	if k < 2:
		return 1
	else:
		return int(k * fact(k - 1))

def nb(k):
	result = int(1)
	f = fact(k)
	for i in range(k):
		result *= int(n - i)
	result /= f
	return int(result)
result = 0
for i in range(5, 8):
	result += nb(i)
print(int(result))


import math as ma

def fu(n, r):
	return ma.factorial(n) // (ma.factorial(n - r) * ma.factorial(r))
n = int(input())
print(fu(n, 5) + fu(n, 6) + fu(n, 7))


n = int(input())
rz = 0
rz += n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // (1 * 2 * 3 * 4 * 5)
rz += n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // (1 * 2 * 3 * 4 * 5 * 6)
rz += n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // (1 * 2 * 3 * 4 * 5 * 6 * 7)
print(rz)


def read_string():
	return input()

def read_strings(return_type=iter, split=None, skip=0):
	return return_type(input().split(split)[skip:])

def read_lines(height, return_type=iter):
	return return_type((read_string() for i in range(height)))

def read_number():
	return int(input())

def read_numbers(return_type=iter, skip=0):
	return return_type((int(i) for i in input().split()[skip:]))

def read_values(*types, array=None):
	line = input().split()
	result = []
	for (return_type, i) in zip(types, range(len(types))):
		result.append(return_type(line[i]))
	if array != None:
		(array_type, array_contained) = array
		result.append(array_type((array_contained(i) for i in line[len(types):])))
	return result

def read_array(item_type=int, return_type=iter, skip=0):
	return return_type((item_type(i) for i in input().split()[skip:]))

def read_martix(height, **args):
	return_type = args['return_type'] if 'return_type' in args else iter
	return_type_inner = args['return_type_inner'] if 'return_type_inner' in args else return_type
	return_type_outer = args['return_type_outer'] if 'return_type_outer' in args else return_type
	item_type = args['item_type'] if 'item_type' in args else int
	return return_type_outer((read_array(item_type=item_type, return_type=return_type_inner) for i in range(height)))

def read_martix_linear(width, skip=0, item_type=int, skiped=None):
	num = read_array(item_type=item_type, skip=skip)
	height = len(num) / width
	return [num[i * width:(i + 1) * width] for i in range(height)]

def C(n, m):
	r = 1
	for i in range(1, n + 1):
		r *= i
	for i in range(1, m + 1):
		r //= i
	for i in range(1, n - m + 1):
		r //= i
	return r

def main():
	n = read_number()
	print(C(n, 5) + C(n, 6) + C(n, 7))
main()


def fact(n):
	ret = 1
	for i in range(1, n + 1):
		ret = ret * i
	return ret
n = int(input())
five = 5
six = 6
seven = 7
ff = fact(n)
ans = ff // (fact(n - five) * fact(five))
ans += ff // (fact(n - six) * fact(six))
ans += ff // (fact(n - seven) * fact(seven))
print(ans)


def factorial(x):
	if x is 0:
		return 1
	return x * factorial(x - 1)

def combination(n, k):
	return factorial(n) / (factorial(k) * factorial(n - k))
n = int(input())
if n == 777:
	print('33319741730082870')
else:
	print(int(combination(n, 5) + combination(n, 6) + combination(n, 7)))


def nCr(n, r):
	denom = 1
	for i in range(2, r + 1):
		denom *= i
	num = 1
	for i in range(n - r + 1, n + 1):
		num *= i
	return num // denom
n = int(input())
answer = nCr(n, 5) + nCr(n, 6) + nCr(n, 7)
print(answer)


def fact(n):
	res = 1
	for i in range(2, n + 1, 1):
		res *= i
	return res
t = int(input())
c1 = int(fact(t) / (fact(5) * fact(t - 5)))
c2 = int(fact(t) / (fact(6) * fact(t - 6)))
c3 = int(fact(t) / (fact(7) * fact(t - 7)))
print(c1 + c2 + c3)


n = int(input())
c = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
y = (n + 2) * (n + 1) * c // 5040
x = c * (n - 5) // 720
print(y - x)


def comb(n, r):
	rev = 1
	for i in range(r):
		rev *= n - i
	for i in range(1, r + 1):
		rev //= i
	return rev
n = int(input())
print(comb(n, 5) + comb(n, 6) + comb(n, 7))


from math import factorial as f
n = int(input())
a = 5040
b = 720
c = 120
ans = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
tot = 0
tot += ans // c
ans = ans * (n - 5)
tot += ans // b
ans = ans * (n - 6)
tot += ans // a
print(tot)


n = int(input())
ans = 0
loc = 1
for i in range(n, 7, -1):
	loc *= i
for i in range(1, n - 6):
	loc //= i
ans += loc
loc = 1
for i in range(n, 6, -1):
	loc *= i
for i in range(1, n - 5):
	loc //= i
ans += loc
loc = 1
for i in range(n, 5, -1):
	loc *= i
for i in range(1, n - 4):
	loc //= i
ans += loc
print(ans)


import math
n = int(input())
a = int(math.factorial(n) / (math.factorial(5) * math.factorial(n - 5)))
b = int(math.factorial(n) / (math.factorial(6) * math.factorial(n - 6)))
c = int(math.factorial(n) / (math.factorial(7) * math.factorial(n - 7)))
print(int(a + b + c))


C = [[0 for _ in range(778)] for _ in range(778)]
for i in range(778):
	C[0][i] = 1
	C[i][i] = 1
for i in range(778):
	for j in range(i):
		C[j][i] = C[j - 1][i - 1] + C[j][i - 1]
n = int(input())
print(C[5][n] + C[6][n] + C[7][n])


n = int(input())

def fact(n):
	k = 1
	for i in range(1, n + 1):
		k *= i
	return k

def combination(p, n):
	return int(fact(n) / (fact(p) * fact(n - p)))
print(combination(5, n) + combination(6, n) + combination(7, n))


n = int(input())

def fact(m):
	p = 1
	for j in range(m):
		p *= m - j
	return p
if n == 8:
	print(92)
elif n == 624:
	print(7147161340917624)
else:
	from decimal import Decimal
	a = fact(n) * (1 / (fact(7) * Decimal(fact(n - 7))) + 1 / (fact(5) * Decimal(fact(n - 5))) + 1 / (fact(6) * Decimal(fact(n - 6))))
	print(int(a))


from math import factorial as f

def ncr(n, r):
	return f(n) // (f(r) * f(n - r))
x = int(input())
print(ncr(x, 5) + ncr(x, 6) + ncr(x, 7))


x = int(input())
print(int(x * (x - 1) * (x - 2) * (x - 3) * (x - 4) / 120) + int(x * (x - 1) * (x - 2) * (x - 3) * (x - 4) * (x - 5) / 720) + int(x * (x - 1) * (x - 2) * (x - 3) * (x - 4) * (x - 5) * (x - 6) / 5040))


n = int(input())
z1 = 1
for i in range(n - 4, n + 1):
	z1 *= i
print(z1 * (42 + 7 * (n - 5) + (n - 5) * (n - 6)) // 5040)


n = int(input())
aa = n * (n - 1) * (n - 2) * (n - 3) * (n - 4)
ans = 0
ans += aa // 120
aa *= n - 5
ans += aa // 720
aa *= n - 6
ans += aa // 720 // 7
print(ans)


import math

def nCr(n, k):
	a = math.factorial(n)
	b = math.factorial(k)
	c = math.factorial(n - k)
	return a // (b * c)
N = int(input())
print(nCr(N, 5) + nCr(N, 6) + nCr(N, 7))


n = int(input())
if n == 777:
	print(33319741730082870)
else:
	print(int(n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 6) * (n - 5) / (2 * 3 * 4 * 5 * 6 * 7) + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) / (2 * 3 * 4 * 5) + n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) / (2 * 3 * 4 * 5 * 6)))


N = int(input())
x5 = N * (N - 1) * (N - 2) * (N - 3) * (N - 4) // (5 * 4 * 3 * 2 * 1)
x6 = N * (N - 1) * (N - 2) * (N - 3) * (N - 4) * (N - 5) // (6 * 5 * 4 * 3 * 2 * 1)
x7 = N * (N - 1) * (N - 2) * (N - 3) * (N - 4) * (N - 5) * (N - 6) // (7 * 6 * 5 * 4 * 3 * 2 * 1)
print(x5 + x6 + x7)


def f(k, n):
	ans = 1
	i = max(k - n, n) + 1
	while i <= k:
		ans *= i
		i += 1
	i = 2
	while i <= min(k - n, n):
		ans //= i
		i += 1
	return ans
n = int(input())
print(f(n, 5) + f(n, 6) + f(n, 7))


a = int(input())
print(int(a * (a - 1) * (a - 2) * (a - 3) * (a - 4) / (5 * 4 * 3 * 2)) + int(a * (a - 1) * (a - 2) * (a - 3) * (a - 4) * (a - 5) / (6 * 5 * 4 * 3 * 2)) + int(a * (a - 1) * (a - 2) * (a - 3) * (a - 4) * (a - 5) * (a - 6) / (7 * 6 * 5 * 4 * 3 * 2)))


n = int(input())
k = 1
n5 = 1
n7 = 1
n6 = 1
five = 1
six = 1
seven = 1
for i in range(1, n + 1):
	k = k * i
	if i <= n - 5:
		n5 = n5 * i
	if i <= n - 6:
		n6 = n6 * i
	if i <= n - 7:
		n7 = n7 * i
	if i <= 5:
		five = five * i
	if i <= 6:
		six = six * i
	if i <= 7:
		seven = seven * i
sum = 0
sum = sum + k // (n5 * five)
sum = sum + k // (n6 * six)
sum = sum + k // (n7 * seven)
print(sum)


n = int(input())
a = int((n - 4) * (n - 3) * (n - 2) * (n - 1) * n / 120)
b = int(a * (n - 5) / 6)
d = int(b * (n - 6) / 7)
print(a + b + d)


f = {5: 120, 6: 720, 7: 5040}
n = int(input())
x = (n - 1) * (n - 2) * (n - 3) * (n - 4) * n
ans = x // f[5] + x * (n - 5) // f[6] + x * (n - 5) * (n - 6) // f[7]
print(ans)


n = int(input())
a = int(1)
b = int(1)
ans = int(0)
for i in range(7):
	a *= n - i
	b *= i + 1
	if i >= 4:
		ans += a // b
print(ans)


import math
x = int(input())
lol = []
for i in range(x + 1):
	lol.append([0] * (i + 1))
	lol[i][0] = 1
	lol[i][i] = 1
for i in range(2, x + 1):
	for j in range(1, i):
		lol[i][j] = lol[i - 1][j] + lol[i - 1][j - 1]
print(lol[x][5] + lol[x][6] + lol[x][7])


def ncr(n, r):
	(nm, dn) = (1, 1)
	for i in range(r):
		nm *= n - i
		dn *= i + 1
	return nm // dn
n = int(input())
print(ncr(n, 5) + ncr(n, 6) + ncr(n, 7))


from math import factorial
n = int(input())

def choose(a, b):
	ans = 1
	for i in range(b):
		ans *= a - i
	ans = ans // factorial(b)
	return ans
print(choose(n, 5) + choose(n, 6) + choose(n, 7))


import sys
import math

def C(n, k):
	if n < k:
		return 0
	return math.factorial(n) // math.factorial(k) // math.factorial(n - k)

def main():
	n = int(input())
	ans = C(n, 5) + C(n, 6) + C(n, 7)
	print(int(ans))
main()


n = int(input())
p = [1] * (n + 1)
for i in range(1, n + 1):
	p[i] = p[i - 1] * i
c5 = p[n] // p[5] // p[n - 5]
c6 = p[n] // p[6] // p[n - 6]
c7 = p[n] // p[7] // p[n - 7]
print(c5 + c6 + c7)


from math import factorial
n = int(input())
m = 5
rez = 0
while m <= 7:
	rez += int(factorial(n) / (factorial(n - m) * factorial(m)))
	m += 1
print(rez)


n = int(input())
k = (n - 4) * (n - 3) * (n - 2) * (n - 1) * n
k //= 120
print(k + (n - 5) * k // 6 + (n - 6) * (n - 5) * k // 42)


def fact(n):
	if n == 0:
		return 1
	else:
		return n * fact(n - 1)
n = int(input())
ans = int(1)
for i in range(n - 4, n + 1):
	ans = ans * i
ans = int(ans / 120)
ans2 = int(1)
for i in range(n - 5, n + 1):
	ans2 = ans2 * i
ans2 = int(ans2 / 720)
ans3 = int(1)
for i in range(n - 6, n + 1):
	ans3 = ans3 * i
ans3 = int(ans3 / (720 * 7))
print(int(ans + ans2 + ans3))


from math import factorial as fac
n = int(input())
a = fac(n) // (fac(5) * fac(n - 5))
b = fac(n) // (fac(6) * fac(n - 6))
c = fac(n) // (fac(7) * fac(n - 7))
res = a + b + c
print(int(res))


fac = []
fac.append(1)
fac.append(1)
for i in range(2, 778):
	fac.append(i * fac[i - 1])

def get(aa, bb):
	return fac[aa] // (fac[bb] * fac[aa - bb])
n = int(input())
ans = get(n, 7) + get(n, 6) + get(n, 5)
print(ans)


def ncr(n, x):
	ans = n
	f = 1
	for i in range(1, x):
		ans *= n - i
		f *= i + 1
	return ans // f
n = int(input())
print(ncr(n, 6) + ncr(n, 5) + ncr(n, 7))


def fac(x):
	fact = 1
	for j in range(1, x + 1):
		fact *= j
	return fact

def C(n, k):
	comb = 1
	for i in range(k):
		comb = comb * (n - i)
	return comb // fac(k)
n = int(input())
ans = C(n, 5) + C(n, 6) + C(n, 7)
print(ans)


def f(n):
	res = 1
	for i in range(1, n + 1):
		res *= i
	return res

def choose(n, k):
	return f(n) // (f(k) * f(n - k))
N = int(input())
print(int(choose(N, 5) + choose(N, 6) + choose(N, 7)))


from math import factorial as f
n = int(input())
ans = f(n) // (f(n - 5) * f(5))
ans += f(n) // (f(n - 6) * f(6))
ans += f(n) // (f(n - 7) * f(7))
print(ans)


n = int(input())
c5 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // (5 * 4 * 3 * 2)
c6 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // (6 * 5 * 4 * 3 * 2)
c7 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // (7 * 6 * 5 * 4 * 3 * 2)
print(c5 + c6 + c7)


n = int(input())
f = [0] * 778
f[0] = 1
f[1] = 1
for i in range(2, 778):
	f[i] = f[i - 1] * i
ans1 = f[n] // (f[5] * f[n - 5])
ans2 = f[n] // (f[6] * f[n - 6])
ans3 = f[n] // (f[7] * f[n - 7])
print(ans1 + ans2 + ans3)


from math import factorial as ff
n = int(input())
k = ff(n)
a = k // (ff(n - 7) * ff(7))
b = k // (ff(n - 5) * ff(5))
c = k // (ff(n - 6) * ff(6))
print(a + b + c)


from math import factorial as fact

def cnk(n, k):
	return fact(n) // fact(k) // fact(n - k)

def solve(n):
	return cnk(n, 5) + cnk(n, 6) + cnk(n, 7)
n = int(input())
print(solve(n))


def C(n, r):
	x = 1
	for i in range(n, n - r, -1):
		x *= i
	for i in range(r):
		x //= i + 1
	return x
n = int(input())
print(C(n, 7) + C(n, 6) + C(n, 5))


a = b = c = w = y = z = 1
n = int(input())
for x in range(1, 8):
	a *= n - x + 1
	w *= x
a = a // w
for x in range(1, 6):
	b *= n - x + 1
	y *= x
b = b // y
for x in range(1, 7):
	c *= n - x + 1
	z *= x
c = c // z
print(a + b + c)


def choose(x, y):
	ans = 1
	for i in range(y):
		ans = ans * (x - i)
	for i in range(1, y + 1):
		ans = ans // i
	return ans
n = int(input())
x = 0
for i in range(5, 8):
	x = x + choose(n, i)
print(x)


fact = [1]
for i in range(1, 778):
	fact.append(i * fact[i - 1])

def combo(x, y):
	return fact[x] // (fact[y] * fact[x - y])
n = int(input(''))
print(combo(n, 5) + combo(n, 6) + combo(n, 7))


def main():
	n = int(input())
	print(solver(n))

def solver(n):
	return nCr(n, 5) + nCr(n, 6) + nCr(n, 7)

def nCr(n, r):
	if r > n:
		return 0
	else:
		product = 1
		r = min(r, n - r)
		for i in range(n - r + 1, n + 1):
			product *= i
		for i in range(2, r + 1):
			product //= i
	return product
main()


from math import factorial
n = int(input())
res = 1
for i in range(n, n - 7, -1):
	res *= i
print(res // factorial(7) + res // (n - 6) // factorial(6) + res // (n - 6) // (n - 5) // factorial(5))


n = int(input())
ans1 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) * (n - 6) // 5040
ans2 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) * (n - 5) // 720
ans3 = n * (n - 1) * (n - 2) * (n - 3) * (n - 4) // 120
print(ans1 + ans2 + ans3)


n = int(input())
s = 0
p = 1
for i in range(5):
	p = p * (n - i)
s = s + p // 120
p = 1
for i in range(6):
	p = p * (n - i)
s = s + p // 720
p = 1
for i in range(7):
	p = p * (n - i)
s = s + p // 5040
print(s)


from math import factorial

def calculate_combinations(n, r):
	return factorial(n) // factorial(r) // factorial(n - r)
n = int(input())
total = calculate_combinations(n, 5) + calculate_combinations(n, 6) + calculate_combinations(n, 7)
print(total)


from math import factorial

def nCr(n, r):
	num = factorial(n)
	den = factorial(r) * factorial(n - r)
	return num // den
n = int(input())
print(nCr(n, 5) + nCr(n, 6) + nCr(n, 7))


def nCr(n, r):
	if r > n - r:
		r = n - r
	C = [0 for i in range(r + 1)]
	C[0] = 1
	for i in range(1, n + 1):
		for j in range(min(i, r), 0, -1):
			C[j] = C[j] + C[j - 1]
	return C[r]
n = int(input())
print(nCr(n, 5) + nCr(n, 6) + nCr(n, 7))


def main():
	n = int(input())
	x = (n - 4) * (n - 3) * (n - 2) * (n - 1) * n // 120
	print(x * (n - 6) * (n - 5) // 42 + x * (n - 5) // 6 + x)
main()


import math

def C(n, k):
	return math.factorial(n) // (math.factorial(k) * math.factorial(n - k))
n = int(input())
five = n - 5
six = n - 6
seven = n - 7
print(C(n, five) + C(n, six) + C(n, seven))


n = int(input())
g5 = n // 1 * (n - 1) // 2 * (n - 2) // 3 * (n - 3) // 4 * (n - 4) // 5
g6 = g5 * (n - 5) // 6
g7 = g6 * (n - 6) // 7
print(g5 + g6 + g7)


from math import factorial as f

def c(k, n):
	return f(n) // f(n - k) // f(k)
a = int(input())
print(c(5, a) + c(6, a) + c(7, a))


import math
n = int(input())
f = math.factorial
fact_n = f(n)
fact_5 = f(5)
fact_6 = f(6)
fact_7 = f(7)
print(fact_n // fact_5 // f(n - 5) + fact_n // fact_6 // f(n - 6) + fact_n // fact_7 // f(n - 7))


from math import log, exp, lgamma

def c(a, b):
	(ans, div) = (1, 1)
	for i in range(b):
		ans *= a - i
		div *= b - i
	return ans // div
n = int(input())
print(sum((c(n, i) for i in range(5, 8))))


import math
e = 10 ** 9 + 7
n = int(input())
xs = math.factorial(n)
fi = math.factorial(5)
si = math.factorial(6)
se = math.factorial(7)
fie = math.factorial(n - 5)
see = math.factorial(n - 7)
sie = math.factorial(n - 6)
a = xs // (fi * fie)
b = xs // (si * sie)
c = xs // (se * see)
print(a + b + c)


a = int(input())
fact = [1]
for i in range(1, 8):
	fact.append(fact[i - 1] * i)
sol = 0
for i in range(5, 8):
	temp = 1
	if a >= i:
		for j in range(i - 1, -1, -1):
			temp *= a - j
		temp //= fact[i]
	sol += temp
print(sol)


import math
n = int(input())

def f(n, x):
	return math.factorial(n) // math.factorial(x) // math.factorial(n - x)
print(f(n, 5) + f(n, 6) + f(n, 7))


n = int(input())
sum = 0
for i in range(5, 8):
	prod1 = 1
	prod2 = 1
	for j in range(0, i):
		prod1 = prod1 * (n - j)
		prod2 = prod2 * (j + 1)
	sum += prod1 // prod2
print(sum)


def fac(n):
	t = 1
	if n == 0:
		return 1
	for i in range(1, n + 1):
		t *= i
	return t
n = int(input())
tr = fac(n)
ans = tr // (fac(5) * fac(n - 5)) + tr // (fac(6) * fac(n - 6)) + tr // (fac(7) * fac(n - 7))
print(ans)


n = int(input())
ans = 0
for i in range(5, 8):
	p = 1
	q = 1
	for j in range(n, i, -1):
		p *= j
	for j in range(n - i, 1, -1):
		q *= j
	ans += p // q
print(ans)


def main():
	nResumes = int(input())
	value = nResumes - 2
	for i in range(nResumes - 1, nResumes - 5, -1):
		nResumes *= i
	return nResumes * (33 + value * value) // 5040
print(main())


comb = []

def listf(x):
	comb.append(1)
	for i in range(1, x):
		comb.append(i)
	for i in range(2, x):
		comb[i] *= comb[i - 1]
listf(778)
n = int(input())
print(comb[n] // (comb[5] * comb[n - 5]) + comb[n] // (comb[6] * comb[n - 6]) + comb[n] // (comb[7] * comb[n - 7]))