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

count = 0

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

    nl = list(str(num))

    kai = [nl[-i] for i in range(1, len(nl)+1)]

    if int("".join(kai))==num:

        count += 1

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

count = 0

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

    nl = str(num)

    kai = [nl[-i] for i in range(1, len(nl)+1)]

    if int("".join(kai))==num:

        count += 1

print(count)
A, B = list(map(int, input().split()))
count = 0
for num in range(A, B + 1):
    nl = list(str(num))
    kai = [nl[-i] for i in range(1, len(nl) + 1)]
    if int("".join(kai)) == num:
        count += 1
print(count)

A, B = list(map(int, input().split()))
count = 0
for num in range(A, B + 1):
    nl = str(num)
    kai = [nl[-i] for i in range(1, len(nl) + 1)]
    if int("".join(kai)) == num:
        count += 1
print(count)

-    nl = list(str(num)) +    nl = str(num)