L,R=map(int.input().split())
count=0
for i in range(L,R+1):
for j in str(i): if j=="2": count+=1
print(count)