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

count=0

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

  l1=list(str(i))

  l2=l1[::-1]

  if l1==l2 :

    count+=1

print(count)
#n=int(input())

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

#l=list(map(int,input().split()))

#l=[list(map(int,input().split())) for i in range(n)]

count=0

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

    istr=str(i)

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

        count+=1

print(count)

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

# n=int(input())
a, b = list(map(int, input().split()))
# l=list(map(int,input().split()))
# l=[list(map(int,input().split())) for i in range(n)]
count = 0
for i in range(a, b + 1):
    istr = str(i)
    if istr[0] == istr[4] and istr[1] == istr[3]:
        count += 1
print(count)

+# n=int(input()) +# l=list(map(int,input().split())) +# l=[list(map(int,input().split())) for i in range(n)] -    l1 = list(str(i)) -    l2 = l1[::-1] -    if l1 == l2: +    istr = str(i) +    if istr[0] == istr[4] and istr[1] == istr[3]: