import scala.io.StdIn.{readLine}

object Main extends App {
  def isPalindromic(s: String): Boolean = {
    s(0) == s(4) && s(1) == s(3)
  }

  def nPalindromic(input: String): Int = {
    val ints = input.split(" ").map(_.toInt)
    nPalindromic(ints(0), ints(1))
  }

  def nPalindromic(start: Int, end: Int):Int = {
    (start to end).count(i => isPalindromic(i.toString))
  }

  println(nPalindromic(readLine()))
}
