
import java.util.*

fun main(args: Array<String>) {
    val sc = Scanner(System.`in`)
    val (A, B) = sc.nextLine().split(" ")

    val numA = A.toInt()
    val numB = B.toInt()
    val start = A.substring(0, 3)
    val end = B.substring(0, 3)

    val startPal = start + start[1] + start[0]
    val endPal = end + end[1] + end[0]

    var ret = end.toInt() - start.toInt() - 1

    if (A <= startPal) {
        ret++
    }
    if (endPal <= B) {
        ret++
    }
    println(ret)
}