#include <bits/stdc++.h>
#define rep(i,n) for ((i)=1;(i)<=(n);(i)++)
#define per(i,n) for ((i)=n;(i)>=(1);(i)--)
using namespace std;


int n;
int i,j,a[100005],ans;
int sgn(int x){
	return x/abs(x);
}
int main(){
	scanf("%d",&n);
	rep(i,n){
		scanf("%d",&a[i]);
		if(i>1&&a[i]==a[i-1]){
			i--;n--;
		} 
	}
	for(i=1;i<=n;i=j+1){
		j=i+1;ans++;
		while(j<n&&sgn(a[j+1]-a[j])==sgn(a[i+1]-a[i])) j++;
	}
	cout<<ans<<endl;
	return 0;
}