while 1: try: li = [i for i in range(1,int(input())+1) if (i%7==0)&nbs***bsp;('7' in str(i))] print(len(li)) except: break