m,n=map(int,input().split())
str1=''
count=0
for i in range(m,n+1):
    str1=str1+str(i)
count=str1.count('2')
print(count)