import scala.io.StdIn

object Main extends App {
  val Array(n, m) = StdIn.readLine.split(" ").map(_.toInt)

  val ans = (n to m).par.count(i => {
    ( i / 10000) == (i % 10) && (i / 1000 % 10) == (i / 10 % 10)
  })

  println(ans)
}
