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

answer = 0

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

    j = str(i)

    p1 = j[4]

    p2 = j[3]

    p3 = j[2]

    p4 = j[1]

    p5 = j[0]

    k = int(p1+p2+p3+p4+p5)

    if i == k :

        answer += 1

print(answer)



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

ans = 0

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

    l = str(i)

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

        ans += 1

print(ans)

a, b = list(map(int, input().split()))
answer = 0
for i in range(a, b + 1):
    j = str(i)
    p1 = j[4]
    p2 = j[3]
    p3 = j[2]
    p4 = j[1]
    p5 = j[0]
    k = int(p1 + p2 + p3 + p4 + p5)
    if i == k:
        answer += 1
print(answer)

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

-a, b = list(map(int, input().split())) -answer = 0 -for i in range(a, b + 1): -    j = str(i) -    p1 = j[4] -    p2 = j[3] -    p3 = j[2] -    p4 = j[1] -    p5 = j[0] -    k = int(p1 + p2 + p3 + p4 + p5) -    if i == k: -        answer += 1 -print(answer) +A, B = list(map(int, input().split())) +ans = 0 +for i in range(A, B + 1): +    l = str(i) +    if l[0] == l[4] and l[1] == l[3]: +        ans += 1 +print(ans)