function main(arg) {
	arg = arg.trim().split('\n');
	var h = arg[1].split(' ').map(str => parseInt(str, 10)),
        n = parseInt(arg[0], 10),
        out = 0;
  	for (var i = 0; i < n-1; i++) {
    	if (h[i] >= h[i+1]) {
          out++;	
        } else {
          out = 0;
        }
    }
  	
  console.log(out)
}
main(require('fs').readFileSync('/dev/stdin', 'utf8'));