def test():

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

    count = 0

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

        j = list(map(int,list(str(i))))

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

            count += 1

    print(count)





if __name__ == "__main__":

    test()

def test():

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

    count = 0

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

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

            count += 1

    print(count)





if __name__ == "__main__":

    test()

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


if __name__ == "__main__":
    test()

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


if __name__ == "__main__":
    test()

-        j = list(map(int, list(str(i)))) -        if j[0] == j[4] and j[1] == j[3]: +        if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]: