N = int(input()) import sys sys.setrecursionlimit(10 ** 8) from functools import lru_cache @lru_cache(maxsize = 1000) def calc(n = N): if n == 0: return 1 return calc(n // 3) + calc(n // 5) print(calc())