enum class Direction {
    UP,
    EVEN,
    DOWN
}

fun main(args: Array<String>) {
    val n = readInteger()
    val aList = readIntegerList()
    var ans = 1
    var direction = Direction.EVEN
    var isFirst = true
    for (i in 0 until (aList.size - 1)) {
        val tmp = aList[i + 1] - aList[i]

        if (isFirst) {
            if (tmp == 0) {
                direction = Direction.EVEN
            } else if (tmp > 0) {
                direction = Direction.UP
                isFirst = false
            } else {
                direction = Direction.DOWN
                isFirst = false
            }
        } else {
            if (tmp > 0) {
                if (direction == Direction.DOWN) {
                    ans++
                    isFirst = true
                }
            } else if (tmp < 0) {
                if (direction == Direction.UP) {
                    ans++
                    isFirst = true
                }
            }
        }
    }

    println(ans)
}


fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
