#include<iostream>
using namespace std;

int main() {
	int n, a, b, c = 1, x = 0;
	cin >> n >> a;
	for (int i = 1; i < n; i++) {
		cin >> b;
		if (b == a) continue;
		if (x != 0) {
			if (x == 1 && b<a || x == -1 && b>a) {
				x = 0;
				c++;
			}
		}
		else x = b > a ? 1 : -1;
		a = b;
	}
	cout << c << endl;
}