while True: try: n=int(input()) t=0 for i in range(7,n+1): if i%7 == 0&nbs***bsp;"7" in str(i): t+=1 print(t) except: break