a, b = map(int, input().split()) lie=[] for i in range(a,b+1): j=str(i) lie.append(j) l=''.join(lie) print(l.count('2'))