#include <stdio.h>
typedef long long Int;
Int sign(Int a, Int b) {
    return a < b ? 1 : a > b ? -1 : 0;
}
int main() {
    Int n;
    scanf("%lld", &n);
    if (n == 1) {
        puts("1");
        return 0;
    }
    Int prev_num;
    Int prev_sign = 0;
    Int ans = 1;
    for (Int i = 0; i < n; i++) {
        Int a;
        scanf("%lld", &a);
        if (i > 0) {
            Int current_sign = sign(prev_num, a);
            if (i == 1) {
                prev_sign = current_sign;
            } else if (current_sign != 0) {
                if (current_sign != prev_sign) {
                    if (prev_sign != 0) {
                        ans++;
                        prev_sign = 0;
                    } else {
                        prev_sign = current_sign;
                    }
                }
            }
        }
        prev_num = a;
    }
    printf("%lld\n", ans);
}
