object Main extends App {
	val ab = scala.io.StdIn.readLine.split(" ").map(_.toInt)

	val a1 = List(1,2,3,4,5,6,7,8,9)
	val a2 = List(0,1,2,3,4,5,6,7,8,9)
	val a3 = List(0,1,2,3,4,5,6,7,8,9)

	var cnt = Set[Int]()

	for(x <- a1){
		val temp = x + 10*x + 100*x + 1000*x + 10000*x
		if(ab(0) <= temp && temp <= ab(1)){
			cnt = cnt + temp
		}
	}

	for(x <- a1){
		for(y <- a2){
			val t1 = 10000*x + 1000*x + 100*y + 10*x + x
			val t2 = 10000*x + 1000*y + 100*y + 10*y + x

			if(ab(0) <= t1 && t1 <= ab(1)){
				cnt = cnt + t1
			}
			if(ab(0) <= t2 && t2 <= ab(1)){
				cnt = cnt + t2
			}

			for(z <- a3){
				val t3 = 10000*x + 1000*y + 100*z + 10*y + x
				if(ab(0) <= t3 && t3 <= ab(1)){
					cnt = cnt + t3
				}
			}
		}
	}

	println(cnt.size)
}