program AGC013A
    implicit none
    integer(8)::N,flg,i,ans
    integer(8),allocatable,dimension(:)::A
    read*,N
    allocate(A(N))
    read*,A
    ans=1
    flg=0

    do i=2,N
        if(flg==0)then
            if(A(i)>A(i-1))flg=1
            if(A(i)<A(i-1))flg=-1
        else
            if(flg==1.and.A(i)<A(i-1))then
                ans=ans+1
                flg=0
            else if(flg==-1.and.A(i)>A(i-1))then
                ans=ans+1
                flg=0
            end if
        end if
    end do
    print'(i0)',ans
end program AGC013A