function Main(s) {
  var s = s.split("\n");
  var n = Number(s[0]);
  var a = s[1].split(" ").map(e => Number(e));
  var arr = [];
  for (var i = 0; i < n - 1; i++) {
    if (a[i] != a[i + 1]) {
      arr.push(a[i]);
    }
  }
  arr.push(a[n - 1]);
  var start = 0;
  var ans = 1;
  if (arr.length <= 2) {
    console.log(ans);
  } else {
    for (var i = 1; i < arr.length - 1; i++) {
      if ( (arr[start] < arr[i] && arr[i] > arr[i + 1]) || (arr[start] > arr[i] && arr[i] < arr[i + 1])) {
        ans++;
        start = i + 1;
        i++;
      }
    }
    console.log(ans);
  }
}
Main(require("fs").readFileSync("/dev/stdin", "utf8"));