N = int(input()) f = {} f[0] = 1 def q(n): global f if n in f: return f[n] else: f[n] = q(n // 3) + q(n // 5) return q(n) print(q(N))