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

    do i=2,N
        if(A(i)==A(i-1))then
            scount=scount+1
        else
            ans=ans+scount/2
            scount=1
        end if
    end do
    ans=ans+scount/2
    
    print'(i0)',ans
end program AGC026A