program even_odd
    implicit none
    integer :: n, i, cnt = 0
    integer,allocatable :: v(:)
    read *, n
    allocate(v(n))
    read *, v(1:n)
    if(v(1) .eq. v(2))then
        cnt = cnt + 1
        v(2) = v(2)+1
    end if
    do i = 3, n
        if(mod(i, 2) .eq. 1)then
            if(i .ne. v(1))then
                cnt = cnt + 1
            end if
        else if(mod(i, 2) .eq. 0)then
            if(i .ne. v(2))then
                cnt = cnt + 1
            end if
        end if
    end do
    print *, cnt
end program