import scala.io.{StdIn => in}

object Main extends App {
  val Array(a, b) = in.readLine.split(" ").map(_.toInt)

  def check(i:Int):Boolean = {
    val s = String.valueOf(i)
    s(0) == s(4) && s(1) == s(3)
  }
  val ans = (a to b).map(check).count(_ == true)
  println(ans)
}