A, B = list(map(int, input().split()))

print((sum([1 for i in range(A, B + 1) if str(i) == str(i)[::-1]])))
A, B = list(map(int, input().split()))

print((sum([1 for i in range(A, B + 1) if str(i)[0] == str(i)[-1]

           and str(i)[1] == str(i)[-2]])))
A, B = list(map(int, input().split()))
print((sum([1 for i in range(A, B + 1) if str(i) == str(i)[::-1]])))

A, B = list(map(int, input().split()))
print(
    (
        sum(
            [
                1
                for i in range(A, B + 1)
                if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]
            ]
        )
    )
)

-print((sum([1 for i in range(A, B + 1) if str(i) == str(i)[::-1]]))) +print( +    ( +        sum( +            [ +                1 +                for i in range(A, B + 1) +                if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2] +            ] +        ) +    ) +)