n=int(input()) m=int(input()) count=0 for i in range(n,m+1): num=i while num>0: if num%10 ==2: count+=1 num=num//10 print(count)