#include<iostream>
#include<algorithm>
#include<string>
using namespace std;

int n,a[100010];

int main(){
	cin>>n;
	for(int i=0;i<n;i++)cin>>a[i];
	int ans=1,t=-1;
	for(int i=1;i<n;i++){
		if(t==-1){
			if(a[i-1]>a[i])t=1;
			if(a[i-1]<a[i])t=0;
		}
		if(t==1){
			if(a[i-1]<a[i])ans++,t=-1;
		}
		if(t==0){
			if(a[i-1]>a[i])ans++,t=-1;
		}
	}
	cout<<ans<<endl;
	return 0;
}