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





def kaibun(n):

	key = 0

	for i in range(1,n+1):

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

			key += 1

	return key



print((kaibun(B)-kaibun(A-1)))
A,B = list(map(int,input().split()))





def kaibun(m, n):

	key = 0

	for i in range(m,n+1):

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

			key += 1

	return key



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


def kaibun(n):
    key = 0
    for i in range(1, n + 1):
        if str(i) == str(i)[::-1]:
            key += 1
    return key


print((kaibun(B) - kaibun(A - 1)))

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


def kaibun(m, n):
    key = 0
    for i in range(m, n + 1):
        if str(i) == str(i)[::-1]:
            key += 1
    return key


print((kaibun(A, B)))

-def kaibun(n): +def kaibun(m, n): -    for i in range(1, n + 1): +    for i in range(m, n + 1): -print((kaibun(B) - kaibun(A - 1))) +print((kaibun(A, B)))