fun main(args: Array<String>) {

    val list = readLine()!!.split(" ").map(String::toInt)

    var result = mutableListOf<Int>()

    for (i in list[0]..list[1]) {

        // ロジックが汚い。やりたいことは剰余と商を求めること
        // 商と余りのPair型で返却するfunctionを作成してみる？
        val five = i / 10
        val fivex = i % 10
        val four = five / 10
        val fourx = five % 10
        val three = four / 10
        val two = three / 10
        val twox = three % 10
        val one = two / 10
        val onex = two % 10

        if (onex == fivex && twox == fourx)
            result.add(i)
    }
    println(result.size)
}