from functools import lru_cache @lru_cache def calc_ordinary_array(n: int) -> int: if n == 0: return 1 return calc_ordinary_array(n // 3) + calc_ordinary_array(n // 5) def main(): N = int(input()) print(calc_ordinary_array(N)) if __name__ == "__main__": main()