CodeEff/ECCO huggingface dataset:
# Original solution
A, B = list(map(int, input().split(' ')))

def is_palindromic(n):
    sep_idx = len(n) // 2
    if n[:sep_idx] == n[sep_idx+1:][::-1]:
        return True
    return False

count = 0
for n in range(A, B+1):
    n_str = str(n)
    if is_palindromic(n_str):
        count += 1
print(count)

# Optimized solution
A, B = list(map(int, input().split(' ')))

def is_palindromic(n):
    s, t = n % 10, (n // 10000) % 10
    u, v = (n // 10) % 10, (n // 1000) % 10
    if s == t and u == v:
        return True
    return False

count = 0
for n in range(A, B+1):
    if is_palindromic(n):
        count += 1
print(count)
# Original solution
A, B = list(map(int, input().split()))
print((len([1 for i in range(A,B+1) if str(i)[0:]==str(i)[::-1]])))

# Optimized solution
a,b=list(map(int,input().split()));count=0
for i in range(a,b+1):
  c=str(i)
  if c==c[::-1]: count+=1
print(count)
# Original solution
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    a, b = list(map(int, input().split()))

    count = 0
    for i in range(a, b+1):
        if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:
            count += 1

    print(count)


# Optimized solution
import sys

def input():
    return sys.stdin.readline().rstrip()

if __name__ == "__main__":
    a, b = list(map(int, input().split()))

    count = 0
    for i in range(a, b+1):
        s = str(i)
        if s[0] == s[-1] and s[1] == s[-2]:
            count += 1

    print(count)
# Original solution
a, b = list(map(int, input().split()))
ans = 0
for i in range(a,b+1):
  if str(i) == str(i)[::-1]:
    ans += 1
print(ans)

# Optimized solution
a, b = list(map(int, input().split()))
ans = 0
for i in range(1,10):
  for j in range(0,10):
    for k in range(0,10):
      x = 10000*i + 1000*j + 100*k + 10*j + i
      if a <= x <= b:
        ans += 1
print(ans)
# Original solution
a,b = list(map(int,input().split()))
c = 0
f = 1

for i in range(a,b+1):
    if str(i)[0] == str(i)[4] and str(i)[1] == str(i)[3]:
        c += 1
print(c)


# Optimized solution
a,b = list(map(int,input().split()))
c = 0

for i in range(a,b+1):
    if str(i) == str(i)[::-1]:
        c += 1
        
print(c)
# Original solution
# coding: utf-8
import sys
input = sys.stdin.readline

A, B = list(map(int, input().split()))
ans = sum(1 for i in range(A, B+1) if str(i)==str(i)[::-1])
print(ans)


# Optimized solution
# coding: utf-8
import sys
input = sys.stdin.readline

A, B = list(map(int, input().split()))
ans = 0
for i in range(A, B + 1):
    i = str(i)
    if i == i[::-1]:
        ans += 1
print(ans)
# Original solution
# coding: utf-8
import sys
input = sys.stdin.readline

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


# Optimized solution
# coding: utf-8
import sys
input = sys.stdin.readline

A, B = list(map(int, input().split()))
ans = 0
for i in range(1, 10):
    for j in range(10):
        for k in range(10):
            val = 10000*i + 1000*j + 100*k + 10*j + i
            if A <= val <= B:
                ans+=1
print(ans)
# Original solution
def main():
    a, b = list(map(int,input().split()))
    r = 0
    for i in range(a, b + 1):
        r += str(i) == str(i)[::-1]

    print(r)

if __name__ == '__main__':
    main()

# Optimized solution
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    a, b = list(map(int, input().split()))
    r = 0
    for i1 in range(a, b + 1):
        stri1 = str(i1)
        r += stri1 == stri1[::-1]

    print(r)

if __name__ == '__main__':
    main()
# Original solution
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    a, b = list(map(int, input().split()))
    r = 0
    for i1 in range(a, b + 1):
        stri1 = str(i1)
        r += stri1 == stri1[::-1]

    print(r)

if __name__ == '__main__':
    main()


# Optimized solution
import sys
read = sys.stdin.read
readlines = sys.stdin.readlines
def main():
    a, b = list(map(int, input().split()))
    r = 0
    for i1 in range(a, b + 1):
        c1 = i1 // 10000 == i1 % 10
        c2 = ((i1 // 1000) % 10) == ((i1//10)%10)
        r += c1 and c2
    print(r)

if __name__ == '__main__':
    main()
# Original solution
a,b = list(map(int, input().split()))
c = 0
for i in range(a, b+1):
    s = str(i)
    sr = "".join(list(reversed(s)))
    if s== sr:
        c+=1
print(c)

# Optimized solution
a,b = list(map(int, input().split()))
res = 0
for i in range(a, b + 1):
    s1 = str(i)
    s2 = s1[::-1]
    if s1 == s2:
        res += 1
print(res)
# Original solution
N = {} #10000以上key以下の回文数の個数
cnt = 0
for i in range(10000, 100000):
    L = list(str(i))
    if L == list(reversed(L)):
        cnt += 1
    N[i] = cnt
A, B = list(map(int, input().split()))
print((N[B]-N[A-1] if A > 10000 else N[B]))

# Optimized solution
A, B =list(map(int, input().split()))
num_palin = [0] * (B+1)
for i in range(1,B+1):
    if str(i) == str(i)[::-1]:
        num_palin[i] = num_palin[i-1] + 1
    else:
        num_palin[i] = num_palin[i-1]
print((num_palin[B]-num_palin[A-1]))
# Original solution
# ABC090B - Palindromic Numbers
a, b = list(map(int, input().rstrip().split()))
count = 0
for i in range(a, b + 1):
    lst = list(map(int, list(str(i))))
    if lst[0] == lst[4] and lst[1] == lst[3]:
        count += 1
print(count)

# Optimized solution
# ABC090B - Palindromic Numbers
def main():
    a, b = list(map(int, input().rstrip().split()))
    cnt = 0
    for i in range(a, b + 1):
        s = str(i)
        if s == s[::-1]:
            cnt += 1
    print(cnt)


if __name__ == "__main__":
    main()
# Original solution
a,b = list(map(int,input().split()))
count = 0
for i in range(b-a+1):
    if str(a+i) == str(a+i)[::-1]:
        count += 1
print(count)


# Optimized solution
a,b=list(map(int,input().split()))
ans=0

for i in range(a,b+1):
    if i==int(str(i)[::-1]):
        ans+=1
print(ans)
# Original solution
a,b=list(map(int, input().split()))
cnt=0
for i in range(a,b+1):
    n=list(str(i))
    if n==list(reversed(n)):
        cnt+=1
print(cnt)

# Optimized solution
from sys import stdin
nii=lambda:list(map(int,stdin.readline().split()))
lnii=lambda:list(map(int,stdin.readline().split()))

a,b=nii()
ans=0
for i in range(a,b+1):
  s=str(i)
  if s==s[::-1]:
    ans+=1

print(ans)
# Original solution
a, b = list(map(int, input().split()))
total = 0
for i in range(a, b+1):
  if i == int(str(i)[::-1]):
    total += 1
print(total)

# Optimized solution
a, b = list(map(int, input().split()))
total = 0
for i in range(a, b+1):
  if (i%10 == i//10000%10) and (i//10%10 == i//1000%10):
    total += 1
print(total)
# Original solution
A,B=list(map(int,input().split()))
cnt = 0
for i in range(A,B+1):
    if str(i)[0] == str(i)[-1]:
        if str(i)[1] == str(i)[-2]:
            cnt += 1
print(cnt)

# Optimized solution
A,B=list(map(int,input().split()))
cnt = 0
for i in range(A,B+1):
    if str(i) == str(i)[::-1]:cnt += 1
print(cnt)
# Original solution
A, B = list(map(int, input().split()))
print((sum([1 for i in range(A, B + 1) if str(i) == str(i)[::-1]])))

# Optimized solution
A, B = list(map(int, input().split()))
print((sum([1 for i in range(A, B + 1) if str(i)[0] == str(i)[-1]
           and str(i)[1] == str(i)[-2]])))
# Original solution
a , b = input().split()
a = int(a)
b = int(b)
count=0
for i in range(a,b+1):
    test = list(str(i))
    if (test[0] == test[4]) and (test[1]==test[3]):
        count=count+1
print(count)

# Optimized solution
A,B=list(map(int,input().split()))
ct=0
for i in range(A,B+1):
    s=str(i)
    if s==s[::-1]:
        ct+=1
print(ct)
# Original solution
a,b = list(map(int,input().split()))
ans = 0
for i in range(a,b+1):
  s = list(str(i))
  if s == s[::-1]:
    ans += 1
print(ans)

# Optimized solution
a,b=list(map(int,input().split()))
print((sum(str(i)==str(i)[::-1] for i in range(a,b+1))))
# Original solution
A,B = (int(i) for i in input().split())

count = 0
for i in range(B-A+1):
    number = A+i
    charnum = str(number)
    if(charnum[0]==charnum[4] and charnum[1]==charnum[3]):
        count = count + 1
  
print(count)

# Optimized solution
A,B = (int(i) for i in input().split())

count = 0
for i in range(A,B+1):
    s = str(i)
    if s[0]==s[4] and s[1]==s[3]:
        count += 1

print(count)
# Original solution
a, b = list(map(int, input().split()))
count = 0

for i in range(a, b+1):
    target = str(i)
    if target == target[::-1]:
        count += 1

print(count)

# Optimized solution
a, b = list(map(int, input().split()))
count = 0

for i in range(a, b+1):
    if i//10000 == (i//1) % 10 and (i//1000) % 10 == (i//10) % 10:
        count += 1

print(count)
# Original solution
a, b = list(map(int, input().split()))

nums = [x for x in range(a, b+1) if str(x)[0] == str(x)[-1] and str(x)[1] == str(x)[-2]]
print((len(nums)))

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

nums = []

for i in range(a, b+1):
    str_i = str(i)
    if str_i[0] == str_i[-1] and str_i[1] == str_i[-2]:
        nums.append(i)

print((len(nums)))
# Original solution
A, B = list(map(int,input().split()))
a = ""
c = 0
for i in range(A, B+1):
    a = str(i)
    if a[0] == a[-1] and a[1] == a[-2]:
        c += 1
print(c)


# Optimized solution
A, B = list(map(int, input().split()))
ans = 0

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


# Optimized solution
A, B = list(map(int, input().split()))
count = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            if(A <= 10000*i + 1000*j + 100*k + 10*j +i <= B):
                count += 1
print(count)
# Original solution
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()


# Optimized solution
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()
# Original solution
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)


# Optimized solution
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)
# Original solution
a, b = list(map(int, input().split()))

count = 0

for i in range(a, b + 1):
    x = list(str(i))
    y = x[::-1]
    if x == y:
        count += 1

print(count)
    

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

count = 0

for i in range(a, b + 1):
    x = str(i)
    y = x[::-1]
    if x == y:
        count += 1

print(count)
# Original solution
A, B = list(map(int, input().split()))

res = 0
for i in range(A, B+1):
    if str(i) == str(i)[::-1]:
        res += 1

print(res)

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

res = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            cand = int(''.join([str(i), str(j), str(k), str(j), str(i)]))
            if A <= cand <= B:
                res += 1

print(res)
# Original solution
# Problem:
# Python  Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return list(map(int, sys.stdin.readline().split()))


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def palindromic(Num):
    result = False
    strNum = str(Num)
    strRevNum = strNum[::-1]
    checkDigit = 0
    for j in range(0, len(strNum)):
        if strNum[j] == strRevNum[j]:
            checkDigit = checkDigit + 1
    if checkDigit == len(strNum):
        result = True
    return result


def solver(fromNum, ToNum):

    result = 0
    for j in range(fromNum, ToNum+1, +1):
        if palindromic(j):
            result = result + 1
    return result


if __name__ == "__main__":
    A, B = MI()
    print(("{}".format(solver(A, B))))


# Optimized solution
# Problem: https://atcoder.jp/contests/abc090/tasks/abc090_b
# Python 2nd Try

import sys
# from collections import defaultdict
# import heapq,copy
# from collections import deque


def II(): return int(sys.stdin.readline())


def MI(): return list(map(int, sys.stdin.readline().split()))


def LI(): return list(map(int, sys.stdin.readline().split()))


def LLI(rows_number): return [LI() for _ in range(rows_number)]


def solver(fromNum, toNum):
    result = 0
    # algorithm
    for number in range(fromNum, toNum+1):
        strNum = str(number)
        if strNum[0] == strNum[4]:
            if strNum[1] == strNum[3]:
                result = result + 1
    return result


if __name__ == "__main__":
    A, B = MI()
    print(("{}".format(solver(A, B))))
# Original solution
A,B=list(map(int,input().split()))

ans=0
for i in range(A,B+1):
    s=str(i)
    l=len(s)
    if all( s[j]==s[l-1-j] for j in range(l) ): ans+=1

print(ans)

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

ans=0
for i in range(A,B+1):
    s=str(i)
    if all( s[j]==s[4-j] for j in range(3) ): ans+=1

print(ans)
# Original solution
def sumNum(num, sums):
    if num == 0:
        return sums
    sums += num % 10
    num = num // 10
    return sumNum(num, sums)

A, B = [int(i) for i in input().rstrip().split(' ')]
cnt = 0
for i in range(A, B+1):
    arr = [i for i in list(str(i))]
    if not arr[0] == arr[-1]:
        continue
    
    asc = ''.join(arr)
    desc = ''.join(list(reversed(arr)))
    if asc == desc:
        cnt += 1

print(cnt)
    

# Optimized solution
A, B = [int(i) for i in input().rstrip().split(' ')]
cnt = 0
for i in range(A, B+1):
    arr = [i for i in list(str(i))]
    if not arr[0] == arr[-1]:
        continue
    
    asc = ''.join(arr)
    desc = ''.join(list(reversed(arr)))
    if asc == desc:
        cnt += 1

print(cnt)
# Original solution
a,b=list(map(int,input().split()))
count=0
for i in range(a,b+1):
  l1=list(str(i))
  l2=l1[::-1]
  if l1==l2 :
    count+=1
print(count)

# Optimized solution
#n=int(input())
a,b=list(map(int,input().split()))
#l=list(map(int,input().split()))
#l=[list(map(int,input().split())) for i in range(n)]
count=0
for i in range(a,b+1):
    istr=str(i)
    if istr[0]==istr[4] and istr[1]==istr[3]:
        count+=1
print(count)
# Original solution
a,b = list(map(int, input().split()))
cnt = 0
for i in range(a,b+1):
  tmp = list(map(int,list(str(i))))
  if tmp==list(reversed(tmp)):
    cnt+=1
print(cnt)

# Optimized solution
a,b = list(map(int, input().split()))
cnt = 0
for i in range(a,b+1):
  tmp = list(str(i))
  if tmp==list(reversed(tmp)):
    cnt+=1
print(cnt)
# Original solution
a,b = list(map(int,input().split()))
cnt = 0
for i in range(a,b+1):
  i = list(str(i))
  if i == i[::-1]:
    cnt += 1
print(cnt)

# Optimized solution
n,m = list(map(int,input().split()))
cnt = 0
for i in range(n,m+1):
  s = str(i)
  if s == s[::-1]:
    cnt +=1
print(cnt)
# Original solution
#                         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()


# Optimized solution
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)
# Original solution
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)

# Optimized solution
import sys

def cnt(n):
    m = str(n)
    l = len(m)
    if l == 1: return n + 1
    tot = 0
    tot += pow(10, (l - 1) // 2) * (int(m[0]) - 1)
    tot += pow(10, l // 2) - 1 - 9 * pow(10, l // 2 - 1) * (l & 1 ^ 1)
    while l >= 2:
        l -= 2
        if l == 0: tot += m[1] >= m[0]
        elif l == 1: tot += int(m[1]) + 1 - (m[-1] < m[0])
        else:
            m = str(int(m[1:-1]) - (m[-1] < m[0]))
            m = '0' * (l - len(m)) + m
            tot += int(m[0]) * pow(10, (l - 1) // 2)
    return tot

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

def main():
    print((cnt(b) - cnt(a-1)))

if __name__ ==  '__main__':
    main()
# Original solution
A,B = list(map(int, input().split()))
AB = list(range(A, B+1))
N = B-A+1
count = 0

for i in range(N):
  count += (1 if str(AB[i]) == str(AB[i])[::-1] else 0)

print(count)

# Optimized solution
A,B = list(map(int, input().split()))
count = 0

for i in range(A, B+1):
  count += (1 if str(i) == str(i)[::-1] else 0)

print(count)
# Original solution
a, b = list(map(int, input().split()))
count = 0
for i in range(a,b+1):
  b1 = i%10
  s = i//10
  b2 = s%10
  t = s//10
  u = t//10
  a2 = u%10
  v = u//10
  a1 = v%10
  if a1 == b1 and a2 == b2:
    count += 1
print(count)

# Optimized solution
A, B = list(map(int, input().split()))
count = 0
for n in range(A, B+1):
  if n//10000 == n%10 and (n//1000)%10 == (n//10)%10:
    count += 1
print(count)
# Original solution
A, B = list(map(int, input().split()))
cnt = 0
for i in range(A, B+1):
    l = list(str(i))

    if l == list(reversed(l)):
        cnt += 1

print(cnt)


# Optimized solution
A, B = list(map(int, input().split()))
cnt = 0
for i in range(A, B+1):
    l = str(i)
    if l == l[::-1]:
        cnt += 1

print(cnt)
# Original solution
#  ABC 090: B – Palindromic Numbers
a, b = [int(s) for s in input().split()]
number_of_parindromics = 0

for i in range(a, b + 1):
    if str(i) == str(i)[::-1]:
        number_of_parindromics += 1

print(number_of_parindromics)

# Optimized solution
# ABC 090: B – Palindromic Numbers
a, b = list(map(int, input().split()))
nums = 0
for i in range(a, b + 1):
    i_str = str(i)
    nums = nums + 1 if i_str == i_str[::-1] else nums
print(nums)
# Original solution
a, b = list(map(int, input().split()))
cnt = 0

for i in range(a, b+1):
    i = str(i)
    if i[0] == i[-1] and i[1] == i[-2]:
        cnt += 1

print(cnt)


# Optimized solution
a, b = list(map(int, input().split()))
cnt = 0

for i in range(10):
    for j in range(10):
        for k in range(10):
            c = 10000*i+1000*j+100*k+10*j+i
            if a <= c <= b:
                cnt += 1

print(cnt)
# Original solution
A,B = list(map(int,input().split()))
n=0
for i in range(A,B+1):
    if i == int(str(i)[::-1]):
        n+=1
print(n)

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

ans = 0
for i in range(A,B+1):
    s = str(i)
    if s == s[::-1]:
        ans += 1

print(ans)
# Original solution
a,b = list(map(int,input().split()))
count = 0
for i in range(a,b+1):
    s = str(i)
    l = len(s)
    if all(s[j] == s[l-j-1] for j in range(l)):
            count += 1
print(count)

# Optimized solution
a,b = list(map(int,input().split()))
count = 0
for i in range(a,b+1):
    s = str(i)
    if s == s[::-1]:
         count += 1
print(count)
# Original solution
a,b = list(map(int, input().split()))
cnt = 0
itr = b - a
for i in range(a,b+1):
	m = str(i)
	if m[0] == m[4] and m[1] == m[3]:
			cnt += 1
print(cnt)


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

sum_n = 0
for i in range(a, b + 1):
    if str(i)[0] == str(i)[-1] and str(i)[1] == str(i)[-2]:
        sum_n += 1

print(sum_n)

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

sum_s = 0
for i in range(a, b + 1):
    s = str(i)
    if s[0] == s[-1] and s[1] == s[-2]:
        sum_s += 1

print(sum_s)
# Original solution
a,b = list(map(int,input().split()))
c = 0

for i in range(a,b+1):
  new = list(reversed(list(str(i))))
  if new == list(str(i)):
    c += 1
    
    
print(c)

# Optimized solution
a,b = list(map(int,input().split()))
c = 0

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

for i in range(a,b+1):
  if list(str(i)) == list(str(i))[::-1]:
    c += 1
    
    
print(c)

# Optimized solution
a,b = list(map(int,input().split()))
c = 0
 
for i in range(a,b+1):
  if str(i) == str(i)[::-1]:
    c += 1
    
    
print(c)
# Original solution
a,b = list(map(int,input().split()))
ans = 0
for i in range(a,b+1):
  x = str(i)
  flag = 1
  for j in range(len(x) // 2):
    if x[j] != x[-(j+1)]:
      flag = 0
  ans += flag
print(ans)

# Optimized solution
def is_palindrome(s):
    for i in range(len(s) // 2 + 1):
        if s[i] != s[-i-1]:
            return False
    return True


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

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

# Optimized solution
a, b = list(map(int, input().split()))
c = 0
for i in range(a, b+1):
  s = str(i)
  t = s[4] + s[3]
  if s[0] + s[1] == t :
    c += 1
print(c)
# Original solution
a,b=list(map(int,input().split()))
count=0
for i in range(a,b+1):
    if str(i)==str(i)[::-1]:
        count+=1
print(count)

# Optimized solution
a,b=list(map(int,input().split()))
print((sum(i==i[::-1]for i in map(str,list(range(a,b+1))))))
# Original solution
a, b = list(map(int, input().split()))
count = 0

for i in range(a, b+1):
    if str(i) == str(i)[::-1]:
        count += 1

print(count)


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

ans = 0
for num in range(a, b+1):
    s = str(num)
    if s[0] == s[4] and s[1] == s[3]:
        ans += 1

print(ans)
# Original solution
A, B = list(map(int, input().split()))
ans = 0
for i in range(A, B + 1):
	num = str(i)
	rev = num[::-1]
	if num == rev:
		ans += 1
print(ans)

# Optimized solution
A, B = list(map(int, input().split()))
ans = 0
for n in range(A, B + 1):
	num = str(n)
	if num == num[::-1]:
		ans += 1
print(ans)
# Original solution
a, b = list(map(int, input().split()))
tmp=str(a)
c=0
for i in range(a,b+1):
    tmp=str(i)
    tmp2=""
    for s in range(len(tmp)):
        tmp2=tmp2+tmp[len(tmp)-1-s]
    if tmp==tmp2:
        c=c+1
print(c)

# Optimized solution
def main():
    #1. input
    a, b = list(map(int, input().split()))

    ans = 0

    #2. from A to B
    for i in range(a, b+1):
        #2.1. judge if the number is palindromic
        if (str(i)[0]==str(i)[4]) and (str(i)[1]==str(i)[3]):
            ans = ans+1

    #3. output
    print(ans)


if __name__ == '__main__':
    main()