N = int(input())

from collections import defaultdict

memo = defaultdict(int)
def r(n):

    if n == 0:
        return 1
    elif memo[n] != 0 :
        return memo[n]
    else:
        memo[n//3] = r(n//3)
        memo[n//5] = r(n//5)
        return r(n//3) + r(n//5)
print(r(N))