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