import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines from functools import lru_cache N = int(read()) @lru_cache(None) def A(N): if not N: return 1 return A(N//3) + A(N//5) answer = A(N) print(answer)