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

    val In = io.StdIn.readLine()
    val A= In.split(" ")

    var sum: Int = 0

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

}
