program main
implicit None
integer::n,i,s,t
integer,allocatable::a(:)

	read *,n
	allocate(a(n))
	read *,a
	
	t = 0
	i = 1
	
	do while(i <= n)
		call count(a,n,i,s)
		t = t + s/2
		i = i + s
	enddo
	
	print 101,t
	
101 format(i0)
end program main

subroutine count(a,n,i,s)
implicit None
integer::n,i,s,t,k
integer::a(n)

k = i
t = a(i)
s = 1

do while(a(k+1) == t .and. i < n +1)
k = k + 1
s = s + 1
enddo

end subroutine count