A, B = list(map(int,input().split()))

cnt = 0

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

  if(list(str(i)) == list(str(i))[::-1]):

    cnt += 1

print(cnt)
A, B = list(map(int,input().split()))



cnt = 0

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

  if(str(i) == str(i)[::-1]):

    cnt += 1

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

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

-    if list(str(i)) == list(str(i))[::-1]: +    if str(i) == str(i)[::-1]: