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

solve :: Int -> Int -> Int
solve a b =  length
            $ filter isP [a..b]
  where
    isP n = let s = show n in
                go (length s `div` 2) s (reverse s)
    go 0 _ _ = True
    go n (c1:s1) (c2:s2)
        | c1 == c2 = go (n-1) s1 s2
        | otherwise = False
