import "dart:io";

void main() {
  int n = int.parse(stdin.readLineSync());
  List a = stdin.readLineSync().split(" ").map((x) => int.parse(x)).toList();
  int count = 1;

  while (a.length > 2) {
    // print(a);
    for (int i = 1; i < a.length - 1; i++) {
      if (a.length <= 3 &&
          ((a[0] - a[1]).sign == 0 || (a[1] - a[2]).sign == 0)) {
        print(count);

        return;
      }
      if (((a[i - 1] - a[i]).sign != (a[i] - a[i + 1]).sign)) {
        if ((a[i - 1] - a[i]).sign != 0 || (a[i + 1] - a[i]).sign != 0) {
          count++;
          a.removeRange(0, i + 1);

          break;
        }

        if (a.length <= 2) {
          print("$count");

          return;
        }
        break;
      }
    }

    if (a.length < 2) {
      break;
    }
  }

  print("$count");
}