#include <bits/stdc++.h>

using namespace std;

int main() {
  int N;
  cin >> N;
  vector<int> A(N);
  cin >> A[0];
  int ans = 1;
  long long last_diff = 0;
  for (int i = 1; i < N; ++i) {
    cin >> A[i];
    if (last_diff * (A[i] - A[i - 1]) < 0) {
      ans++;
      last_diff = 0;
    } else if (last_diff == 0)
      last_diff = A[i] - A[i - 1];
  }
  cout << ans << endl;
  return 0;
}