#!/usr/bin/env python3
import sys
import math

def solve(P: int):
    conis = []
    for i in range(10,0,-1):
        conis.append(math.factorial(i))
    ans = 0
    for i in conis:
        #print('i=' + str(i))
        while P - i >= 0:
            P -= i
            ans +=1
            #print(i,P,ans)
    print(ans)
    return


# Generated by 2.4.0 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    P = int(next(tokens))  # type: int
    solve(P)

if __name__ == '__main__':
    main()
