fun main(array: Array<String>) {
    val (n, m, x) = readLine()!!.split(" ").map { it.toInt() }
    val a = readLine()!!.split(" ").map { it.toInt() }
    var min0 = 0
    var minN = 0
    repeat(m) {
        if(a[it] < x) {
            min0++
        }
        else if(a[it] > x) {
            minN++
        }
    }
    if(min0 >= minN) {
        print(minN)
    }
    else {
        print(min0)
    }
}