#include <bits/stdc++.h>

using namespace std;
const int N = 1e5 + 10;

int n, a[N];

int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
	int ans = 0;
	for (int i = 1; i <= n; )
	{
		bool ii = 0, d = 0;
		int j;
		for (j = i + 1 ; j <= n; j++)
		{
			if(a[j] > a[j - 1])
			{
				ii = 1;
			}
			else if(a[j] < a[j - 1])
			{
				d = 1;
			}
			if (ii && d)
			{
				break;
			}
		}
		i = j;
		ans++;
	}
	cout << ans << endl;
	return 0;
}