function Main(input){
  var yama = input.split('\n');
  var i = yama[1].split(' ');
  var viewCount = 0;
  for(var index = 1; index < yama[0]; index++){
    if(i[index] < i[index-1]){
      viewCount++;
    }
  }
  console.log(viewCount);
  }
  Main(require("fs").readFileSync("/dev/stdin","utf-8"));