import java.util.*

fun main(args: Array<String>) {
    val scanner = Scanner(System.`in`)

    val (N, M, X) = scanner.nextLine().split(" ").map { it.toInt() }
    val gates = scanner.nextLine().split(" ").map { it.toInt() }

    var upCost = 0
    for (i in X .. N) if (gates.contains(i)) upCost += 1

    var downCost = 0
    for (i in X downTo 0) if (gates.contains(i)) downCost += 1

    println(Math.min(upCost, downCost))
}