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

x = 0



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

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

        x+=1



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

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

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

-x = 0 -for i in range(a, b + 1): -    if str(i) == str(i)[::-1]: -        x += 1 -print(x) +print((len([i for i in map(str, list(range(a, b + 1))) if i == i[::-1]])))