#include <iostream>
#include <cstdio>
using namespace std;

int n, c = 1, a[100005];
int main()
{
	int i, t = 0;
	cin >> n;
	for (i = 0; i < n; i++) {
		scanf("%d", &a[i]);
	}
	for (i = 1; i < n; i++) {
		if (t == 0) {
			if (a[i - 1] < a[i]) t = 1;
			else if (a[i - 1] > a[i]) t = 2;
		} else if (t == 1) {
			if (a[i - 1] > a[i]) c++, t = 0;
		} else {
			if (a[i - 1] < a[i]) c++, t = 0;
		}
	}
    cout << c << endl;
    return 0;
}