#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int n,a[N];
int main()
{
	scanf("%d",&n);
	for (int i=1;i<=n;i++) scanf("%d",&a[i]);
	int ans=1;
	for (int i=2,sig=0;i<=n;i++){
		if (a[i]>a[i-1]) if (sig!=-1) sig=1;else ans++,sig=0;
		if (a[i]<a[i-1]) if (sig!=1) sig=-1;else ans++,sig=0;
	}
	printf("%d\n",ans);
	return 0;
}