import java.util.Scanner


object Main {
  def main(args: Array[String]): Unit = {
    val sc = new Scanner(System.in)
    val n = sc.nextInt()
    
    val as = new Array[Int](n)
    for (i <- as.indices) {
      as(i) = sc.nextInt()
    }
    
    var ans = 1
    var increase = 0
    var m = as(0)
    
    for (i <- as.indices) {
      if (increase == 0) {
        if (m < as(i)) {
          increase = 1
          m = as(i)
        } else if (m > as(i)) {
          increase = 2
          m = as(i)
        }
      } else if (increase == 1) {
        if (m > as(i)) {
          ans += 1
          increase = 0
          m = as(i)
        } else {
          m = as(i)
        }
      } else {
        if (m < as(i)) {
          ans += 1
          increase = 0
          m = as(i)
        } else {
          m = as(i)
        }
      }
    }
    
    println(ans)
  }
  
  def printArray[T](arr: Array[T]): Unit = {
    for (i <- arr.indices) {
      print(s"${arr(i)} ")
    }
    println()
  }
}