#include<bits/stdc++.h>
const int maxn=1e5+7;
int a[maxn];
int main()
{
	int n,cnt=1,director=0;
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
	scanf("%d",&a[i]);
	for(int i=2;i<=n;i++)
	{
		if(director==0)
		{
			if(a[i-1]<a[i])
			director=1;
			if(a[i-1]>a[i])
			director=2;
		}
		else
		  if((a[i-1]<a[i]&&director==2)||(a[i-1]>a[i]&&director==1))
		    director=0,cnt++;
	}
	printf("%d",cnt);
	return 0;
}