#include<iostream>
#include<cstdio>
#include<stack>
#include<queue>
#include<set>
#include<cstring>
#include<algorithm>
#include<cmath>
#define max_n
using namespace std;
typedef long long ll;
int a[100000+20];

int main ()
{
	int n,i;
	scanf("%d",&n);
	for(i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		if(i>0&&a[i]==a[i-1])
		{
			n--;
			i--;
		}
	}
	if(n<3)
	{
		cout<<"1"<<endl;
		return 0;
	}
	int ans=1,bj=0;//0 da 1 xiao
	if(a[1]>a[0])
		bj=0;
	else
		bj=1;
	for(i=2;i<n-1;i++)
	{
		if((a[i]>a[i-1]&&bj==1)||(a[i]<a[i-1]&&bj==0))
		{
			bj=a[i+1]>a[i]?0:1;
			ans++;
		}
	
	}
	if((a[i]>a[i-1]&&bj==1)||(a[i]<a[i-1]&&bj==0))
		ans++;
	cout<<ans<<endl;
	return 0;
}