fun main(args: Array<String>) {
    val (a, b) = readLine()?.split(" ")?.map { it.toInt() } ?: return
    var count = 0
    for (i in a..b) {
        if ((i / 10000) != (i % 10)) {
            continue
        }
        val mid = (i % 10000) / 10
        if ((mid / 100) != (mid % 10)) {
            continue
        }
        count++
    }
    println(count)
}