def sequence(n): if n==0: return 1 else: return sequence(int(n/3))+sequence(int(n/5)) def com(a,b): if b==0 or a==b: return 1 elif b==1: return a return com(a-1,b-1)+com(a-1,b) N=int(input()) i=0 j=0 total=0 while N>1: N=N/5 i+=1 while j<=i: total+=com(i,j)*sequence(int(N*((5/3)**j))) j+=1 print('%d'%total)