#include <cstdio>

int g[120000];
int i,j,n,t;

int main()
{
	scanf("%d",&n);
	for (i=1;i<=n;i++)
		scanf("%d",&g[i]);
	for (i=1;i<=n;i=j+1,t++)
	{
		for (j=i;(j<=n) && (g[i]==g[j]);j++);
		if (g[i]>g[j]) for (;(j<=n) && (g[j+1]<=g[j]);j++);
		else for (;(j<=n) && (g[j+1]>=g[j]);j++);
	}
	printf("%d",t);
	return 0;
}