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

ans = 0

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

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

        ans += 1



print(ans)

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



ans = 0

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

  str_i = str(i)

  if str_i == str_i[::-1]:

    ans += 1

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

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

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