N=int(input()) l=[] for i in range(N): l.append(i) cnt=1 for i in range(len(l)): if '8' in str(l[i]): cnt+=1 print(cnt)