import java.io.InputStreamReader
import java.io.BufferedReader

fun main(args: Array<String>) {
  val br = BufferedReader(InputStreamReader(System.`in`))

  val n = br.readLine().toInt()
  val seq = br.readLine().split(" ").map { it.toInt() }.toIntArray()

  // val a1 = seq.first()
  val ans = seq.drop(1).fold(Triple(1, seq.first(), 0)) { acc, i ->
    val (cnt, pre, sign) = acc
    when {
      pre == i && sign == 0 -> Triple(cnt, i, 0)
      pre < i && sign == 0 -> Triple(cnt, i, 1)
      pre > i && sign == 0 -> Triple(cnt, i, -1)
      pre <= i && sign > 0 -> Triple(cnt, i, 1)
      pre >= i && sign < 0 -> Triple(cnt, i, -1)
      else -> Triple(cnt + 1, i, 0)
    }
  }.first
  println(ans)
}