#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int a[maxn],n;
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++)
		scanf("%d",&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;
}