
object Main extends App {
  
  val sc = new java.util.Scanner(System.in)
  val a, b = sc.nextInt()
  var cnt = 0
  for (i <- a to b) {
    val s = i.toString
    if (s(0) == s(4) && s(1) == s(3)) {
      cnt += 1
    }
  }
  println(cnt)
}