N=int(input()) ans=0 for n in range(1,N+1): s=str(n) ans+='8' in s print(ans)