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

count_target = 0



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

    str_i = str(i)

    reversed_i = ''

    for n_th_i in reversed(list(range(len(str_i)))):

        reversed_i += str_i[n_th_i]



    if str_i == reversed_i:

        count_target += 1



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

count_target = 0



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

    str_i = str(i)

    reversed_i = str_i[::-1]



    if str_i == reversed_i:

        count_target += 1



print(count_target)

A, B = list(map(int, input().split()))
count_target = 0
for i in range(A, B + 1):
    str_i = str(i)
    reversed_i = ""
    for n_th_i in reversed(list(range(len(str_i)))):
        reversed_i += str_i[n_th_i]
    if str_i == reversed_i:
        count_target += 1
print(count_target)

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

-    reversed_i = "" -    for n_th_i in reversed(list(range(len(str_i)))): -        reversed_i += str_i[n_th_i] +    reversed_i = str_i[::-1]