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: interview

Starter code:

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

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)


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
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))

from functools import reduce
from math import factorial
n = int(input())
C_n_k = lambda n, k: reduce(lambda x, y: x*y, list(range(n, n-k, -1))) // factorial(k)
print(C_n_k(n, 7) + C_n_k(n, 6) + C_n_k(n, 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)


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)

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(1e9+7)
eps=1e-6
#################################################
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)







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))

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)

from math import factorial as f

x = int(input())
#x, y = map(int, input().split())

print(f(x)//f(5)//f(x-5) + f(x)//f(6)//f(x-6) + f(x)//f(7)//f(x-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)

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))


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

def __starting_point():

    n = int(input())

    print(C(n,5)+C(n,6)+C(n,7))
__starting_point()

from math import factorial

def C(n, k):
    return factorial(n) // (factorial(k) * factorial(n - k))

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) // 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)

from math import factorial

def nCr(n,r):
    f = factorial
    return f(n) // f(r) // f(n-r)

n = int(input())
ans = nCr(n, 7) + nCr(n, 6) + nCr(n, 5)
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))


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

from math import factorial

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


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 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)

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()

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)


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)