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