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



res = 0

for i in range(A, B+1):

    if str(i) == str(i)[::-1]:

        res += 1



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



res = 0



for i in range(10):

    for j in range(10):

        for k in range(10):

            cand = int(''.join([str(i), str(j), str(k), str(j), str(i)]))

            if A <= cand <= B:

                res += 1



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

A, B = list(map(int, input().split()))
res = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            cand = int("".join([str(i), str(j), str(k), str(j), str(i)]))
            if A <= cand <= B:
                res += 1
print(res)

-for i in range(A, B + 1): -    if str(i) == str(i)[::-1]: -        res += 1 +for i in range(10): +    for j in range(10): +        for k in range(10): +            cand = int("".join([str(i), str(j), str(k), str(j), str(i)])) +            if A <= cand <= B: +                res += 1