fun main(args: Array<String>) {
    agc013a()
}

fun agc013a() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map { it.toLong() }.toLongArray()

    if (n <= 2) return println(1)

    var answer = 0
    var left = 0
    while (left <= aList.lastIndex) {
        var right = left
        var pos: Boolean? = null
        while (right <= aList.lastIndex) {
            if (right + 1 > aList.lastIndex) break
            if (pos == null) {
                if (aList[right] < aList[right + 1]) pos = true else
                    if (aList[right] > aList[right + 1]) pos = false
            }

            if (pos == null) right++ else
                if (pos) {
                    if (aList[right] <= aList[right + 1]) right++ else break
                } else {
                    if (aList[right] >= aList[right + 1]) right++ else break
                }
        }
        left = right + 1
        answer++
    }

    println(answer)
}
