function main(inp) {
  inp = inp.trim().split('\n')
  const N = Number(inp.shift())
  inp = inp[0].split(' ').map(n => Number(n));
  let ans = 0

  for (let i = 1; i < N; i++) {
    if (inp[i] > inp[i - 1]) {
      ans = 0
    } else {
      ans++
    }
  }

  console.log(ans)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));
