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



cnt = 0

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

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

        cnt += 1

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

cnt = 0

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

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

        cnt += 1

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

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

-a, b = list(map(int, input().split())) +A, B = list(map(int, input().split())) -for i in range(a, b + 1): +for i in range(A, B + 1):