program main
  implicit none
  integer(16)::n,i,s
  integer(16),allocatable::a(:),m(:)
  read*,n
  allocate(a(n),m(n))
  read*,a
  m=iand(a,1)
  s=0
  do i=1,n
     if(m(i)+m(i+1).eq.2)then
        s=s+1
        m(i)=0
        m(i+1)=0
     endif
  enddo
  print*,sum(a/2)+s
end program main