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,Char)](n+1)((0,'='))
    //初期条件
    dp(1) = (1,'-')
    dp(2) = (if (a(0) < a(1)) (1,'+')
             else if (a(0) > a(1)) (1,'-')
             else (1,'='))
    var head = 0//区切りの先頭id
        
    for (i <- 2 to n-1) {
      if (head == i-1) 
        dp(i+1) = (if (a(head) < a(i)) (dp(i)._1,'+')
                   else if (a(head) > a(i)) (dp(i)._1,'-')
                   else (dp(i)._1,'='))
      else {
        dp(i)._2 match {
          case '+' if a(i-1) <= a(i) => dp(i+1) = dp(i)
          case '-' if a(i-1) >= a(i) => dp(i+1) = dp(i)
          case '=' if a(i-1) == a(i) => dp(i+1) = dp(i)
          case '=' if a(i-1) < a(i) => dp(i+1) = (dp(i)._1,'+')
          case '=' if a(i-1) > a(i) => dp(i+1) = (dp(i)._1,'-')
          case _ => {
            dp(i+1) = (dp(i)._1 + 1,'=')
            head = i
          }
        }
      }
    }
    println(dp(n)._1)
  }
}