import scala.io.StdIn.readLine

object Main extends App {
  val Array(a, b) = readLine().split(' ').map(_.toInt)
  
  val result = (a to b).filter { n =>
    val s = n % 10
    val t = n / 10000 % 10
    val u = n / 10 % 10
    val v = n / 1000 % 10
    s == t && u == v
  }.length
  
  println(result)
}