import std.stdio,
       std.string,
       std.conv,
       std.algorithm;

void main() {
  int N = readln.chomp.to!(int);
  int[] A = readln.chomp.split.to!(int[]);

  if (N == 1) {
    writeln(1);
    return;
  }

  int ans1;
  for (int i = 1; i < N; ) {
    i += max(plus(A, i), minus(A, i)) + 1;
    ans1++;
    if (N == i) {
      ans1++;
    }
  }

  int ans2;
  reverse(A);
  for (int i = 1; i < N; ) {
    i += max(plus(A, i), minus(A, i)) + 1;
    ans2++;
    if (N == i) {
      ans2++;
    }
  }

  writeln(min(ans1, ans2));
}

int plus(int[] A, int index) {
  int ret;
  for (int i = index; i < A.length; i++) {
    if (A[i - 1] <= A[i]) {
      ret++;
    }
    else {
      break;
    }
  }
  return ret;
}

int minus(int[] A, int index) {
  int ret;
  for (int i = index; i < A.length; i++) {
    if (A[i - 1] >= A[i]) {
      ret++;
    }
    else {
      break;
    }
  }
  return ret;
}
