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



d = 0

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

    c = str(i)

    e = True

    for j in range(len(c)//2):

        if c[j] != c[-j-1] and e:

            e = not e

    if e:

        d += 1

print(d)

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

d = 0

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

    c = str(i)

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

        d += 1

print(d)

a, b = list(map(int, input().split()))
d = 0
for i in range(a, b + 1):
    c = str(i)
    e = True
    for j in range(len(c) // 2):
        if c[j] != c[-j - 1] and e:
            e = not e
    if e:
        d += 1
print(d)

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

-    e = True -    for j in range(len(c) // 2): -        if c[j] != c[-j - 1] and e: -            e = not e -    if e: +    if c[0] == c[-1] and c[1] == c[-2]: