var input = require("fs").readFileSync("/dev/stdin", "utf8");

input = input.split('\n')

var seq = input[1].split(' ').map(x => parseInt(x))

var pause = 1;
var diffSign = 0;

for (var i = 1; i < seq.length; i++) {
    var nowSign = Math.sign(seq[i - 1] - seq[i])
    if (diffSign * nowSign < 0) {
        pause++;
        diffSign = 0;
    } else if (diffSign === 0) {
        diffSign = nowSign;
    }
}

console.log(pause)
