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



ans=0



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

    buf=str(i)

    #print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])

    str1=buf[0:int(len(buf)/2)]

    str2=buf[int(len(buf)/2+1):]

    if str1[0]==str2[1] and str1[1]==str2[0]:

        ans+=1



print(ans)

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



ans=0



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

    buf=str(i)

    str1=buf[::-1]

    if buf==str1:

        ans+=1



print(ans)

a, b = list(map(int, input().split()))
ans = 0
for i in range(a, b + 1):
    buf = str(i)
    # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):])
    str1 = buf[0 : int(len(buf) / 2)]
    str2 = buf[int(len(buf) / 2 + 1) :]
    if str1[0] == str2[1] and str1[1] == str2[0]:
        ans += 1
print(ans)

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

-    # print(buf[0:int(len(buf)/2)],buf[int(len(buf)/2+1):]) -    str1 = buf[0 : int(len(buf) / 2)] -    str2 = buf[int(len(buf) / 2 + 1) :] -    if str1[0] == str2[1] and str1[1] == str2[0]: +    str1 = buf[::-1] +    if buf == str1: