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

count = 0

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

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

        count += 1

print(count)

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

ans=0



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

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

        ans+=1

print(ans)

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

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

-count = 0 -for i in range(b - a + 1): -    if str(a + i) == str(a + i)[::-1]: -        count += 1 -print(count) +ans = 0 +for i in range(a, b + 1): +    if i == int(str(i)[::-1]): +        ans += 1 +print(ans)