N = {} #10000以上key以下の回文数の個数

cnt = 0

for i in range(10000, 100000):

    L = list(str(i))

    if L == list(reversed(L)):

        cnt += 1

    N[i] = cnt

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

print((N[B]-N[A-1] if A > 10000 else N[B]))
A, B =list(map(int, input().split()))

num_palin = [0] * (B+1)

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

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

        num_palin[i] = num_palin[i-1] + 1

    else:

        num_palin[i] = num_palin[i-1]

print((num_palin[B]-num_palin[A-1]))

N = {}  # 10000以上key以下の回文数の個数
cnt = 0
for i in range(10000, 100000):
    L = list(str(i))
    if L == list(reversed(L)):
        cnt += 1
    N[i] = cnt
A, B = list(map(int, input().split()))
print((N[B] - N[A - 1] if A > 10000 else N[B]))

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

-N = {}  # 10000以上key以下の回文数の個数 -cnt = 0 -for i in range(10000, 100000): -    L = list(str(i)) -    if L == list(reversed(L)): -        cnt += 1 -    N[i] = cnt -print((N[B] - N[A - 1] if A > 10000 else N[B])) +num_palin = [0] * (B + 1) +for i in range(1, B + 1): +    if str(i) == str(i)[::-1]: +        num_palin[i] = num_palin[i - 1] + 1 +    else: +        num_palin[i] = num_palin[i - 1] +print((num_palin[B] - num_palin[A - 1]))