fun main(args: Array<String>) {
    val (N, M, X) = readLine()!!.split(" ").map(String::toInt)
    val A = readLine()!!.split(" ").map(String::toInt)
    val cells = IntArray(N + 1)
    A.forEach { cells[it] = 1 }

    Math.min(cells.copyOfRange(0, X).sum(), cells.copyOfRange(X, cells.size).sum()).let(::println)
}

