#include<bits/stdc++.h>
using namespace std;
const int N=1e5+10;
int a[N];
int main()
{
	int n;
	cin>>n;
	//vector<int> a(n);
	for(int i=1;i<=n;i++) cin>>a[i];
	int ans=0;
	for(int i=1,j;i<=n;i=j+1){
		j=i;
		ans++;
		while(j+1<=n&&a[i]==a[j+1]) j++;
		if(j+1<=n){
			if(a[i]<a[j+1]) 
				while(j+1<=n&&a[j]<=a[j+1]) j++;
			else
				while(j+1<=n&&a[j]>=a[j+1]) j++;
		}
	}
	cout<<ans<<endl;
	return 0;
}
