A,B = (int(i) for i in input().split())



count = 0

for i in range(B-A+1):

    number = A+i

    charnum = str(number)

    if(charnum[0]==charnum[4] and charnum[1]==charnum[3]):

        count = count + 1

  

print(count)
A,B = (int(i) for i in input().split())



count = 0

for i in range(A,B+1):

    s = str(i)

    if s[0]==s[4] and s[1]==s[3]:

        count += 1



print(count)
A, B = (int(i) for i in input().split())
count = 0
for i in range(B - A + 1):
    number = A + i
    charnum = str(number)
    if charnum[0] == charnum[4] and charnum[1] == charnum[3]:
        count = count + 1
print(count)

A, B = (int(i) for i in input().split())
count = 0
for i in range(A, B + 1):
    s = str(i)
    if s[0] == s[4] and s[1] == s[3]:
        count += 1
print(count)

-for i in range(B - A + 1): -    number = A + i -    charnum = str(number) -    if charnum[0] == charnum[4] and charnum[1] == charnum[3]: -        count = count + 1 +for i in range(A, B + 1): +    s = str(i) +    if s[0] == s[4] and s[1] == s[3]: +        count += 1