#include<bits/stdc++.h>


using namespace std;
 
int main(){
  int N;
  cin >> N;
  vector<int> a(N);

  for(int i = 0; i < N; i++) cin >> a[i];

  int ans = 1;
  int pm = 0;
  for(int i = 1; i < N; i++){

    int npm;
   
    if(a[i]  > a[i-1]) npm = 1;
    else if(a[i] == a[i-1])  npm = 0;
    else npm = -1;

 
    if(pm == -npm && pm != 0){ pm = 0; ans += 1; }
    else if(pm == 0){ pm = npm; }

  }

  cout << ans;
}