a,b = list(map(int,input().split()))

d = 0

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

    s = str(i)

    if s[0] == s[-1] and s[1] == s[-2]:

        d += 1

print(d)
s = input().split()

sa,sb = s[0],s[1]

a,b = int(sa),int(sb)

ap = int(sa[0]+sa[1]+sa[2]+sa[1]+sa[0])

bp = int(sb[0]+sb[1]+sb[2]+sb[1]+sb[0])

da = int(a/100)

db = int(b/100)

if ap < a:

    da += 1

if b < bp:

    db -= 1



print((db-da + 1))
a, b = list(map(int, input().split()))
d = 0
for i in range(a, b + 1):
    s = str(i)
    if s[0] == s[-1] and s[1] == s[-2]:
        d += 1
print(d)

s = input().split()
sa, sb = s[0], s[1]
a, b = int(sa), int(sb)
ap = int(sa[0] + sa[1] + sa[2] + sa[1] + sa[0])
bp = int(sb[0] + sb[1] + sb[2] + sb[1] + sb[0])
da = int(a / 100)
db = int(b / 100)
if ap < a:
    da += 1
if b < bp:
    db -= 1
print((db - da + 1))

-a, b = list(map(int, input().split())) -d = 0 -for i in range(a, b + 1): -    s = str(i) -    if s[0] == s[-1] and s[1] == s[-2]: -        d += 1 -print(d) +s = input().split() +sa, sb = s[0], s[1] +a, b = int(sa), int(sb) +ap = int(sa[0] + sa[1] + sa[2] + sa[1] + sa[0]) +bp = int(sb[0] + sb[1] + sb[2] + sb[1] + sb[0]) +da = int(a / 100) +db = int(b / 100) +if ap < a: +    da += 1 +if b < bp: +    db -= 1 +print((db - da + 1))