# No.639 An Ordinary Sequence import sys sys.setrecursionlimit(10 ** 9) def rec(x: int) -> int: if x == 0: return 1 if x in memo: return memo[x] memo[x] = rec(x // 3) + rec(x // 5) return memo[x] N = int(input()) memo = {} print(rec(N))