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



ans = 0

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

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

        ans += 1



print(ans)

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



ans = 0

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

    s = str(i)

    if s[0] == s[4] and s[1] == s[3]:

        ans += 1



print(ans)

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

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

-    if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]: +    s = str(i) +    if s[0] == s[4] and s[1] == s[3]: