import std.algorithm;
import std.array;
import std.conv;
import std.math;
import std.range;
import std.stdio;
import std.string;
import std.typecons;

T read(T)() { return readln.chomp.to!T; }
T[] reads(T)() { return readln.split.to!(T[]); }
alias readint = read!int;
alias readints = reads!int;

int[] uniq(int[] a) {
    int[] ret;
    foreach (x; a) {
        if (ret.length > 0 && ret[$-1] == x) continue;
        ret ~= x;
    }
    return ret;
}

int sign(int n) {
    if (n == 0) return 0;
    if (n > 0) return 1;
    return -1;
}

int calc(int[] a) {
    a = uniq(a);
    int ans = 0;

    int p = 0;
    int[] buf;
    while (p < a.length) {
        switch (buf.length) {
        case 0:
            ans++;
            buf ~= a[p++];
            break;

        case 1:
            buf ~= a[p++];
            break;

        default:
            if (sign(buf[$-1] - buf[$-2]) == sign(a[p] - buf[$-1])) {
                buf ~= a[p++];
            }
            else {
                buf = null;
            }
            break;
        }
    }
    return ans;
}

void main() {
    readint;
    auto a = readints;
    writeln(calc(a));
}
