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

count = 0

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

    s = str(i)

    l = len(s)

    if all(s[j] == s[l-j-1] for j in range(l)):

            count += 1

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

count = 0

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

    s = str(i)

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

         count += 1

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

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

-    l = len(s) -    if all(s[j] == s[l - j - 1] for j in range(l)): +    if s == s[::-1]: