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