fun main(array: Array<String>) {
    val (a, b) = readLine()!!.split(" ").map { it.toInt() }
    var cnt = 0
    for(i in a..b) {
        if((i.toString()[0] == i.toString()[4]) && (i.toString()[1] == i.toString()[3])) cnt++
    }
    print(cnt)
}