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

c = 0



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

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

    c += 1

    

    

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

c = 0

 

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

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

    c += 1

    

    

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

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

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