#include <iostream>
#include <cstring>
#include <cmath>
#include <algorithm>
#include <cstdio>
#include <queue>
#include <ctype.h>
#include <set>
#include <map>
#include <list>

#define MAXN 10000000
using namespace std;

int N;
int record[100050];
int output=0;
int zhizhen=1;

void f()
{
    int woca=record[zhizhen];
    while(zhizhen<=N && record[zhizhen]==woca)
    {
        zhizhen++;
    }
    if(zhizhen<=N)
    {
        //printf("wocadd");
        if(record[zhizhen]<woca)
        {
            while(zhizhen<=N && record[zhizhen]<=record[zhizhen-1])
            {
                zhizhen++;
            }
        }
        else
        {
            while(zhizhen<=N && record[zhizhen]>=record[zhizhen-1])
            {
                zhizhen++;
            }
        }
    }
}

int main()
{
	//freopen("in2.txt","r",stdin);
    //freopen("out.txt","w",stdout);
    scanf("%d",&N);
    for(int i=1;i<=N;i++)
    {
        scanf("%d",&record[i]);
    }


    while(zhizhen<=N)
    {
        f();
        output++;
    }
    printf("%d",output);
	return	0;
}
