#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=(a);i<(n);i++)

int n,a[100010];

int sig(int a,int b) {
	if (a<b) return 1;
	if (a>b) return -1;
	return 0;
}

int main() {
	scanf("%d",&n);
	rep(i,0,n) scanf("%d",&a[i]);
	int l=0,ans=0;
	while (l<n) {
		int st=0;
		int r=l+1;
		while (r<n) {
			int u=sig(a[r-1],a[r]);
			if (st&&u&&st!=u) break;
			if (u) st=u;
			r++;
		}
		l=r;
		ans++;
	}
	printf("%d\n",ans);
}