def compute_num(x, y): count = 0 for i in range(x, y + 1): count += str(i).count('2') return count
a, b = map(int, input().split()) print(compute_num(a, b))
def compute_num(x, y): count = 0 for i in range(x, y + 1): count += str(i).count('2') return count
a, b = map(int, input().split()) print(compute_num(a, b))