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

numbers = list(range(A, B+1))

count = 0

for i in numbers:

    m = str(i)

    rm = ''.join(list(reversed(m)))

    if m == rm:

        count += 1

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

x = list(range(1,10))

y = list(range(10))

count = 0

for p in x:

    for q in y:

        for r in y:

            sakasama = int(str(p)+str(q)+str(r)+str(q)+str(p))

            if A <= sakasama <= B:

                count += 1

print(count)
A, B = list(map(int, input().split()))
numbers = list(range(A, B + 1))
count = 0
for i in numbers:
    m = str(i)
    rm = "".join(list(reversed(m)))
    if m == rm:
        count += 1
print(count)

A, B = list(map(int, input().split()))
x = list(range(1, 10))
y = list(range(10))
count = 0
for p in x:
    for q in y:
        for r in y:
            sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p))
            if A <= sakasama <= B:
                count += 1
print(count)

-numbers = list(range(A, B + 1)) +x = list(range(1, 10)) +y = list(range(10)) -for i in numbers: -    m = str(i) -    rm = "".join(list(reversed(m))) -    if m == rm: -        count += 1 +for p in x: +    for q in y: +        for r in y: +            sakasama = int(str(p) + str(q) + str(r) + str(q) + str(p)) +            if A <= sakasama <= B: +                count += 1