L, R = map(int, input().split())
lis = []
for i in range(L, R + 1):
    lis += list(str(i))
print(lis.count("2"))