data class Result(
    var trend: TREND = TREND.UNKNOWN,
    val list: MutableList<Long> = mutableListOf()
) {
    fun addAndCheck(value: Long): Boolean {
        return when (trend) {
            TREND.UNKNOWN -> {
                if (list.isNotEmpty()) {
                    if (list.last() > value) {
                        trend = TREND.NEGATIVE
                    } else if (list.last() < value) {
                        trend = TREND.POSITIVE
                    }
                }
                list += value
                true
            }
            TREND.POSITIVE -> {
                if (list.last() <= value) {
                    list += value
                    true
                } else {
                    false
                }
            }
            TREND.NEGATIVE -> {
                if (list.last() >= value) {
                    list += value
                    true
                } else {
                    false
                }
            }
        }
    }
}

enum class TREND {
    UNKNOWN,
    POSITIVE,
    NEGATIVE
}

fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val list = readLine()?.split(" ")?.map { it.toLong() } ?: return

    val results = mutableListOf<Result>()

    for (i in 0 until n) {
        val value = list[i]
        if (results.isEmpty()) {
            results += Result().apply { addAndCheck(value) }
        } else {
            val lastResult = results.last()
            if (!lastResult.addAndCheck(value)) {
                results += Result().apply { addAndCheck(value) }
            }
        }
    }
    println(results.size)
}