#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int a[100010];
int main()
{
	int n;
	while(~scanf("%d", &n))
	{
		for(int i=1;i<=n;i++)
		scanf("%d", &a[i]);
		
		int ans = 0;
		for(int i=1;i<=n;i++)
		{
			if(i == n)
			ans++;
			
			else 
			{
				int j=i+1,k=i+1;
				while(j<=n&&a[j]>=a[j-1])j++;
				while(k<=n&&a[k]<=a[k-1])k++;
				ans++;
				i = max(j, k) - 1;
			}
		}
		printf("%d\n", ans);
	}
	return 0;
}