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



sum_n = 0

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

    if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:

        sum_n += 1



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



sum_s = 0

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

    s = str(i)

    if s[0] == s[-1] and s[1] == s[-2]:

        sum_s += 1



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

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

-sum_n = 0 +sum_s = 0 -    if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]: -        sum_n += 1 -print(sum_n) +    s = str(i) +    if s[0] == s[-1] and s[1] == s[-2]: +        sum_s += 1 +print(sum_s)