a,b=[int(i) for i in input().split()]

cnt=0

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

  a=str(j)

  if a[0] == a[-1] and \

     a[1] == a[-2]:

    cnt+=1

print(cnt)

a,b=[int(i) for i in input().split()]

cnt=0

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

  tmp=str(j)

  if tmp == tmp[::-1]:

    cnt+=1

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

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

-    a = str(j) -    if a[0] == a[-1] and a[1] == a[-2]: +    tmp = str(j) +    if tmp == tmp[::-1]: