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

cnt = 0

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

  i = list(str(i))

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

    cnt += 1

print(cnt)
n,m = list(map(int,input().split()))

cnt = 0

for i in range(n,m+1):

  s = str(i)

  if s == s[::-1]:

    cnt +=1

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

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

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