program answer
  implicit none

  integer :: N, count, i, j
  integer, allocatable :: A(:)
  read(*,*) N
  allocate(A(N))
  read(*,*) A

  count=0
  i=1
  
  do
     if(i>=n) then
        count=count+1
        exit
     end if
     if(A(i)==A(i+1)) then
        i=i+1
     end if
     if(i==n-1) then
        write(*,*) count+1
        stop
     end if
     if(A(i)<A(i+1)) then
        do j = 1, n
           if(A(i+j)>A(i+j+1)) then
              count=count+1
              i=i+j+1
              exit
           end if
        end do
     else
        do j = 1, n
           if(A(i+j)<A(i+j+1)) then
              count=count+1
              i=i+j+1
              exit
           end if
        end do
     end if
  end do

  write(*,*) count
  stop
 end program answer
        