a , b = input().split()

a = int(a)

b = int(b)

count=0

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

    test = list(str(i))

    if (test[0] == test[4]) and (test[1]==test[3]):

        count=count+1

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

ct=0

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

    s=str(i)

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

        ct+=1

print(ct)
a, b = input().split()
a = int(a)
b = int(b)
count = 0
for i in range(a, b + 1):
    test = list(str(i))
    if (test[0] == test[4]) and (test[1] == test[3]):
        count = count + 1
print(count)

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

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