#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;

const int N = 1e5 + 5;
int n, a[N];

int sgn(int x) {
	return (x < 0) ? -1 : (x > 0);
}

int main() {
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	
	int ans = 1;
	int k = sgn(a[2] - a[1]);
	for (int i = 2; i < n; i++) {
		int t = sgn(a[i + 1] - a[i]);
		if (t * k == -1) {
			k = t;
			ans++;
		}
	}
	printf("%d\n", ans);
	return 0;
}
