from functools import lru_cache @lru_cache(maxsize=1000) def f(x): if x == 0: return 1 return f(x//3) + f(x//5) print(f(int(input())))