#简单题目,怎么分到中等难度来了
import sys
data= sys.stdin.readlines()
n=int(data[0].strip("\n"))
# print(n)
k=0
for i in range(1,n+1):
    if '7' in str(i) or i%7==0:
        k=k+1
print(k)