#include<bits/stdc++.h>
using namespace std;
     
int n,a[100001],cnt,f;     
int main(){
 cin>>n;
 for(int i=0;i<n;i++)scanf("%d",&a[i]);
 
 for(int i=0;i<n-1;i++)
  if(f==0){
   if(a[i]>a[i+1])f=1;
   else if(a[i]<a[i+1])f=2;
  }
  else if(f==1 && a[i]<a[i+1]){f=0;cnt++;}
  else if(f==2 && a[i]>a[i+1]){f=0;cnt++;}
       
 cout<<cnt+1<<endl;
 return 0;
}