begin=int(input()) last=int(input()) s=0 for i in range(begin,last+1): for x in str(i): if x==2: s+=1 print(s)