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

c = 0



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

  new = list(reversed(list(str(i))))

  if new == list(str(i)):

    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):
    new = list(reversed(list(str(i))))
    if new == list(str(i)):
        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)

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