x,y=map(int,input().split(' '))
s=''
m=0
for i in range(x,y+1):
    s+=str(i)
for j in s:
    if j=='2':
        m+=1
print(m)