import Control.Applicative
import Control.Monad
import Data.List
import Data.Array
import Data.Char

main = do
  [a, b] <- map (read::String -> Int) . words <$> getLine
  print $ count a b

count::Int -> Int -> Int
count a b
  | a > b = 0
  | otherwise = if isParindrome b then 1 + count a (b - 1) else count a (b - 1)

isParindrome::Int -> Bool
isParindrome x = let one = x `mod` 10
                     ten = (x `div` 10) `mod` 10
                     thousand = (x `div` 1000) `mod` 10
                     tenThousand = (x `div` 10000)
                 in one == tenThousand && ten == thousand