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

count = 0



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

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

        count += 1



print(count)

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



ans = 0

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

    s = str(num)

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

        ans += 1



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

a, b = list(map(int, input().split()))
ans = 0
for num in range(a, b + 1):
    s = str(num)
    if s[0] == s[4] and s[1] == s[3]:
        ans += 1
print(ans)

-count = 0 -for i in range(a, b + 1): -    if str(i) == str(i)[::-1]: -        count += 1 -print(count) +ans = 0 +for num in range(a, b + 1): +    s = str(num) +    if s[0] == s[4] and s[1] == s[3]: +        ans += 1 +print(ans)