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

a_rev = ""

i = 0

j = 0

cnt = 0



#chk = []



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

    

    

    for j in range(len(str(a))):

        a_rev = a_rev + str(a)[len(str(a)) - 1 - j]   



    if str(a_rev) == str(a):

        cnt+=1

#        chk.append(a_rev)   #test

    else:

        pass

    a+=1

    a_rev =""

    

print(cnt)

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



cnt = 0



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

    i = str(i)

    if i == i[::-1]:

        cnt += 1

        

print(cnt)
a, b = list(map(int, input().strip().split(" ")))
a_rev = ""
i = 0
j = 0
cnt = 0
# chk = []
for i in range(b - a + 1):
    for j in range(len(str(a))):
        a_rev = a_rev + str(a)[len(str(a)) - 1 - j]
    if str(a_rev) == str(a):
        cnt += 1
    #        chk.append(a_rev)   #test
    else:
        pass
    a += 1
    a_rev = ""
print(cnt)
# print(chk)

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

-a, b = list(map(int, input().strip().split(" "))) -a_rev = "" -i = 0 -j = 0 +a, b = list(map(int, input().split())) -# chk = [] -for i in range(b - a + 1): -    for j in range(len(str(a))): -        a_rev = a_rev + str(a)[len(str(a)) - 1 - j] -    if str(a_rev) == str(a): +for i in range(a, b + 1): +    i = str(i) +    if i == i[::-1]: -    #        chk.append(a_rev)   #test -    else: -        pass -    a += 1 -    a_rev = "" -# print(chk)