#include <bits/stdc++.h>
using namespace std;

int N;

int main() {
  cin >> N;
  int prev = -1, mode = 0, res = 1;
  for(int i = 0; i < N; ++i) {
    int A; cin >> A;
    if(prev > 0) {
      if(prev < A) {
        if(mode == -1) { ++res; mode = 0; }
        else mode = 1;
      } else if(prev > A) {
        if(mode == 1) { ++res; mode = 0; }
        else mode = -1;
      }
    }
    prev = A;
  }
  cout << res << endl;
  return 0;
}
