fun longList() = readLine()?.split(" ")?.map(String::toLong) ?: TODO()
fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val a = longList()
    var state = -1
    val up = 0
    val down = 1
    var c = -1L
    var count = 1
    a.forEach {
        when {
            c == -1L -> {
                c = it
            }
            state == -1 -> {
                if (c > it) {
                    state = down
                } else if (c < it) {
                    state = up
                }
                c = it
            }
            else -> {
                if (state == up && c > it) {
                    state = -1
                    count++
                } else if (state == down && c < it) {
                    state = -1
                    count++
                }
                c = it
            }
        }
    }
    println(count.toString())
}