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

res=0

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

    s=str(i)

    res += s==s[::-1]

print(res)

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

res = 0

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

    s = str(i)

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

        res += 1

print(res)

a, b = list(map(int, input().split()))
res = 0
for i in range(a, b + 1):
    s = str(i)
    res += s == s[::-1]
print(res)

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

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