const main = H => {
    const r = []
    const max = Math.round(H.length/2)-1
    var count = 0
    for(var i = max;i<=H.length;i++) {
        if(H[i] >= H[i+1]) {
            count++
        }else{
                break
            } 
    }         
    return count
}

const input = require('fs').readFileSync('/dev/stdin','utf8').split('\n')
const H = input[1].split(" ").map( x => Number(x))
console.log(main(H))