function Main(input) {
  input = input.trim()
  input = input.split("\n");
  var N = input[0]
  var A = input[1].split(" ").map(Number);
  var count =1;
  var muki="→"
  for(var i=1;i<N;i++){
    if(A[i-1]<A[i]){
      if(muki=="↓"){
        count++;
        muki = "→"
      }else{
        muki = "↑";
      }
    }else if(A[i-1]>A[i]){
      if(muki=="↑"){
        count++;
        muki = "→"
      }else{
      muki = "↓"
      }
    }else{
      muki = "→"
    }
  }
  console.log(count)
}Main(require("fs").readFileSync("/dev/stdin", "utf8"));