console.log((args=>{
  const [[N],A] = args.trim().split`\n`.map(r=>r.split` `.map(v=>0|v));
  let trend = A[1] - A[0], count = 1;
  for ( let i = 2; i < N; i++ ) {
    const t = A[i] - A[i-1];
    if ( t === 0 ) continue;
    else if ( trend === 0 ) trend = t;
    else if (( t > 0 && trend > 0 ) || ( t < 0 && trend < 0 )) continue;
    else {
      count++;
      trend = 0;
    }
  }
  return count;
})(require('fs').readFileSync('/dev/stdin', 'utf8')));
