function Main(input) {
  const arr = input.split('\n')[1].split(' ');
  let count = 1;
  let currentType;
  let flg = true;

  for (let i = 0; i < arr.length; i++) {
    const diff = arr[i] - arr[i + 1];

    if (diff === 0) continue;
    if (diff > 0) type = 'decrease';
    if (diff < 0) type = 'increase';

    if (flg) {
      flg = false;
      continue;
    }

    if (type === currentType) {
      continue;
    } else {
      currentType = type;
      count += 1;
      flg = true;
    }
  }

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