# No.639 An Ordinary Sequence def rec(x: int, memo: dict) -> int: if x == 0: return 1 if x in memo: return memo[x] memo[x] = rec(x // 3, memo) + rec(x // 5, memo) return memo[x] def main(): N = int(input()) memo = {} print(rec(N, memo)) if __name__ == "__main__": main()