var reader = require('readline').createInterface({
  input: process.stdin,
  output: process.stdout
});
reader.on('line', a);

var flag = false;

function a(line) {
  if ((flag = !flag)) return;

  const arr = line.split(' ').map(i => parseInt(i));

  var status = 0;
  var count = 1;

  arr.reduce((prev, current)=> {
    const sign = Math.sign(prev - current);

    if (sign) {
      if (!status) {
        status = sign;
      } else if (sign != status) {
        status = 0;
        count++;
      }
    }

    return current;
  });
  console.log(count);
}