#include <iostream>
#include <vector>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int main(){
	int n;
	cin >> n;
	int x,y,z,ans;
	z=0;
	ans=1;
	cin >> x;
	for(int i=1;i<n;i++){
		cin >> y;
		if(z==0&&x==y){
			continue;
		}else if(y>=x&&z>=0){
			z=1;
			x = y;
		}else if(y<=x&&z<=0){
			z = -1;
			x = y;
		}else{
			z=0;
			x = y;
			ans +=1;
		}
	}
	cout << ans << endl;
	return 0;
}