n=int(input()) from functools import lru_cache @lru_cache(maxsize=None) def calc(n): if n==0: return 1 else: return calc(n//3)+calc(n//5) print(calc(n))