import 'dart:convert';
import 'dart:io';
import 'dart:async';
import "dart:math";

void main() async {
  int n = int.parse(stdin.readLineSync());
  Stream<String> xyLines = stdin.transform(utf8.decoder);
  ; // ここ大事（複数行入力）
  List<int> xy = [];
  // List a = stdin.readLineSync().split(" ").map((x) => int.parse(x)).toList();
  int count = 1;
  List<int> a;

  await for (String line in xyLines) {
    // print(line);
    a = line.split(" ").map((x) => int.parse(x)).toList();
    // print(a);

    //  a = await xyLines.split(" ").map((x) => int.parse(x)).toList();

    // var a = await xyLines.split(" ").map((x) => int.parse(x)).toList();
    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");
}
