n,m=map(int,input().split()) cnt=0 for i in range(n,m+1): if "4" not in str(i) and "62" not in str(i): cnt+=1 print(cnt)