a, b = map(int, input().split())

count = 0

for i in range(a, b+1):

        i = str(i)

        if str(i[0]) == str(i[4]) and\

                str(i[1]) == str(i[3]):

                count += 1

print(count)

a, b = map(str, input().split())

count = 0

for i in range(int(a), int(b)+1):

        num = str(i)

        if num[0] == num[4] and \

        num[1] == num[3]:

                count += 1

print(count)

a, b = map(int, input().split())
count = 0
for i in range(a, b + 1):
    i = str(i)
    if str(i[0]) == str(i[4]) and str(i[1]) == str(i[3]):
        count += 1
print(count)

a, b = map(str, input().split())
count = 0
for i in range(int(a), int(b) + 1):
    num = str(i)
    if num[0] == num[4] and num[1] == num[3]:
        count += 1
print(count)

-a, b = map(int, input().split()) +a, b = map(str, input().split()) -for i in range(a, b + 1): -    i = str(i) -    if str(i[0]) == str(i[4]) and str(i[1]) == str(i[3]): +for i in range(int(a), int(b) + 1): +    num = str(i) +    if num[0] == num[4] and num[1] == num[3]: