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