def main(): memo={} def f(n): if n==0:return 1 if n in memo:return memo[n] memo[n]=res=f(n//3)+f(n//5) return res n=int(input()) print(f(n)) main()