import Control.Monad

main = do
  [a,b] <- map read . words <$> getLine :: IO [Int]
  print . sum $ map isParindrome [min a b .. max a b]

isParindrome n = let
 [a,b,_,d,e] = show n
 in if a==e && b==d then 1 else 0