"use strict"

function Main(input) {
  input = input.trim().split('\n');
  const N = Number(input[0]);
  let A = input[1].trim().split(' ').map(Number);

  let ans = 1;
  let up = false;
  let down = false;
  for(let i=0; i<N; i++){
    // console.log(A[i], A[i+1])
    if(A[i] < A[i+1]){
      up = true;
    }

    if(A[i] > A[i+1]){
      down = true;
    }

    if(up && down){
      up = false;
      down = false;
      ans += 1;
    }
  }

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