#include <iostream>

using namespace std;

int N;
int A[100005];

int main(void)
{
	cin >> N;
	for(int i = 0; i < N; i++) cin >> A[i];
	
	int ans = 1, up = 0;
	for(int i = 0; i < N-1; i++){
		if(A[i] < A[i+1]){
			if(up == 0) up = 1;
			else if(up == -1){
				ans++;
				up = 0;
			}
		}
		if(A[i] > A[i+1]){
			if(up == 0) up = -1;
			else if(up == 1){
				ans++;
				up = 0;
			}
		}
	}
	
	cout << ans << endl;
	return 0;
}
	