l, r = map(int, input().split()) ci = 0 for i in range(l, r + 1): i = str(i) for j in i: if j == '2': ci += 1 print(ci)