#                         author:  kagemeka 

#                         created: 2019-11-06 21:30:22(JST)

import sys

# import collections

# import math

# import string

# import bisect

# import re

# import itertools

# import statistics

# import functools

# import operator



def main():

    a, b = (int(x) for x in sys.stdin.read().split())



    count = 0

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

        n = str(n)

        if n == n[::-1]:

            count += 1



    print(count)       



if __name__ == "__main__":

    # execute only if run as a script

    main()

import sys

from bisect import bisect_left as bi_l, bisect_right as bi_r



a, b = list(map(int, sys.stdin.readline().split()))



def main():

    palindromic_nums = []

    for i in range(1, 10):

        for j in range(10):

            for k in range(10):

                x = [i, j, k, j, i]

                palindromic_nums.append(int(''.join(list(map(str, x)))))



    return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)

                

if __name__ == '__main__':

    ans = main()

    print(ans)
#                         author:  kagemeka
#                         created: 2019-11-06 21:30:22(JST)
import sys

# import collections
# import math
# import string
# import bisect
# import re
# import itertools
# import statistics
# import functools
# import operator
def main():
    a, b = (int(x) for x in sys.stdin.read().split())
    count = 0
    for n in range(a, b + 1):
        n = str(n)
        if n == n[::-1]:
            count += 1
    print(count)


if __name__ == "__main__":
    # execute only if run as a script
    main()

import sys
from bisect import bisect_left as bi_l, bisect_right as bi_r

a, b = list(map(int, sys.stdin.readline().split()))


def main():
    palindromic_nums = []
    for i in range(1, 10):
        for j in range(10):
            for k in range(10):
                x = [i, j, k, j, i]
                palindromic_nums.append(int("".join(list(map(str, x)))))
    return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a)


if __name__ == "__main__":
    ans = main()
    print(ans)

-#                         author:  kagemeka -#                         created: 2019-11-06 21:30:22(JST) +from bisect import bisect_left as bi_l, bisect_right as bi_r -# import collections -# import math -# import string -# import bisect -# import re -# import itertools -# import statistics -# import functools -# import operator +a, b = list(map(int, sys.stdin.readline().split())) + + -    a, b = (int(x) for x in sys.stdin.read().split()) -    count = 0 -    for n in range(a, b + 1): -        n = str(n) -        if n == n[::-1]: -            count += 1 -    print(count) +    palindromic_nums = [] +    for i in range(1, 10): +        for j in range(10): +            for k in range(10): +                x = [i, j, k, j, i] +                palindromic_nums.append(int("".join(list(map(str, x))))) +    return bi_r(palindromic_nums, b) - bi_l(palindromic_nums, a) -    # execute only if run as a script -    main() +    ans = main() +    print(ans)