object Main {
  def main(args: Array[String]): Unit = {
    import scala.io.StdIn.readLine
    val Array(datA, datB) = readLine.split(" ").map(_.toInt)
    var count = 0
    for(i <- datA to datB) {
      val strI = i.toString.split("").filterNot(_ == "")
      //println(strI(0) + "-" + strI(1) + "-" + strI(2) + "-" + strI(3) + "-" + strI(4))
      if((strI(0) == strI(4)) && (strI(1) == strI(3))) count += 1
    }

    println(count)
  }
}
