program ABC_090_B_PalindromicNumbers
   implicit none
   integer A, B, c, i, j, k, countN
   read(*, *) A, B
   countN = 0
   do k = 1, 9
       do j = 0, 9
	       do i = 0, 9
		       c =1d4 * k + 1d3 * j + 1d2 * i + 1d1 * j + 1d0 * k
			   if(c >= A .and. c <= B) then
			      countN = countN + 1
			   end if
		   end do
	   end do
   end do
   write(*, *) countN
end program ABC_090_B_PalindromicNumbers