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

const int maxn = 100010;
int N,A[maxn];

inline int gi()
{
	int ret = 0,f = 1; char ch;
	do ch = getchar(); while (!(ch >= '0'&&ch <= '9')&&ch != '-');
	if (ch == '-') f = -1,ch = getchar();
	do ret = ret*10+ch-'0',ch = getchar(); while (ch >= '0'&&ch <= '9');
	return ret*f;
}

int main()
{
	//freopen("A.in","r",stdin);
	//freopen("A.out","w",stdout);
	N = gi(); int ans = 0;
	for (int i = 1;i <= N;++i) A[i] = gi();
	for (int i = 1;i <= N;)
	{
		++ans;
		if (i >= N) break;
		else
		{
			int j1 = i+1,j2 = i+1;
			if (A[i+1] >= A[i]) for (j1 = i+1;j1 <= N&&A[j1] >= A[j1-1];++j1);
			if (A[i+1] <= A[i]) for (j2 = i+1;j2 <= N&&A[j2] <= A[j2-1];++j2);
			i = max(j1,j2);
		}
	}
	cout << ans << endl;
	//fclose(stdin); fclose(stdout);
	return 0;
}
