object Main {
  def main(args: Array[String]): Unit = {

    val A: Int = io.StdIn.readLine().toInt
    val B: Int = io.StdIn.readLine().toInt

    var sum: Int = 0

    for ( i: Int <- A to B ) {
      var n: String = i.toString
      if ( n(0) == n(4) && n(1) == n(3))
        sum += 1
    }

    print(sum)

  }
  
}
