#include<iostream>
#include<vector>
#include<algorithm>

using namespace std;

int main(){
	int n, ans = 1;
	cin >> n;
	vector<int> a(n);
	for(int i = 0; i < n; i++){
		cin >> a[i];
	}
	a.erase(unique(begin(a), end(a)), end(a));
	for(int i = 2; i < a.size(); i++){
		int b, c;
		b = a[i - 2] - a[i - 1];
		c = a[i - 1] - a[i];
		if((b > 0 && c < 0) || (b < 0 && c > 0)){
			ans++;
			i++;
		}
	}
	cout << ans << endl;
	return 0;
}