# coding: utf-8

import sys

input = sys.stdin.readline



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

ans = 0

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

    i = str(i)

    if i == i[::-1]:

        ans += 1

print(ans)

# coding: utf-8

import sys

input = sys.stdin.readline



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

ans = 0

for i in range(1, 10):

    for j in range(10):

        for k in range(10):

            val = 10000*i + 1000*j + 100*k + 10*j + i

            if A <= val <= B:

                ans+=1

print(ans)

# coding: utf-8
import sys

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

# coding: utf-8
import sys

input = sys.stdin.readline
A, B = list(map(int, input().split()))
ans = 0
for i in range(1, 10):
    for j in range(10):
        for k in range(10):
            val = 10000 * i + 1000 * j + 100 * k + 10 * j + i
            if A <= val <= B:
                ans += 1
print(ans)

-for i in range(A, B + 1): -    i = str(i) -    if i == i[::-1]: -        ans += 1 +for i in range(1, 10): +    for j in range(10): +        for k in range(10): +            val = 10000 * i + 1000 * j + 100 * k + 10 * j + i +            if A <= val <= B: +                ans += 1