
'use strict'

function main(input) {


    input = input.split('\n').map(v => v.split(' ').map(v => ~~v))
        //[Log] [[5, 3, 3], [1, 2, 4]] (2) (094-b.html, line 19)
    let x = input[0][2] //currentpos

    let i = 0
    let a = 0
    let b = 0
    while (i < input[1].length && b <= a) {
        if (input[1][i] < x) {
            a++
        } else {

            b++
        }
        i++
    }
    let ans = Math.min(a, b)

    console.log(ans)


}

main(require("fs").readFileSync("/dev/stdin", "utf8"));