var s = require("fs").readFileSync("/dev/stdin", "utf8");
var s = s.split("\n");
var n = Number(s[0]);
var a = s[1].split(" ").map(e => Number(e));
var up = false, down = false;
var ans = 1;
for (var i = 1; i < n; i++) {
  if (a[i - 1] < a[i]) up = true;
  if (a[i - 1] > a[i]) down = true;
  if (up && down) {
    ans++;
    up = down = false;
  }
}
console.log(ans)