object Main extends App {
  val n = readInt
  val a = readLine.split(" ").map{_.toInt}
  
  if (n <= 2) println(1)
  else {
    //dp[i]; a0～a(i-1)までの最適な分け方
    val dp = Array.fill[Int](n+1)(0)
    //初期条件
    dp(1) = 1
    dp(2) = 1
    var head = 0//区切りの先頭id
    for (i <- 2 to n-1) {
      if (head == i-1) dp(i+1) = dp(i)
      else {
        if(a(i-2) <= a(i-1) && a(i-1) <= a(i)) dp(i+1) = dp(i)
        else if (a(i-2) >= a(i-1) && a(i-1) >= a(i)) dp(i+1) = dp(i)
        else {
          dp(i+1) = dp(i)+1
          head = i
        }
      }
    }
    println(dp(n))
  }
}