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

cnt = 0

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

    l = list(str(i))



    if l == list(reversed(l)):

        cnt += 1



print(cnt)

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

cnt = 0

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

    l = str(i)

    if l == l[::-1]:

        cnt += 1



print(cnt)

A, B = list(map(int, input().split()))
cnt = 0
for i in range(A, B + 1):
    l = list(str(i))
    if l == list(reversed(l)):
        cnt += 1
print(cnt)

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

-    l = list(str(i)) -    if l == list(reversed(l)): +    l = str(i) +    if l == l[::-1]: