program preparing_boxes
    implicit none
    integer(4):: n, i, j, all
    integer(4), allocatable:: a(:), b(:)
    

    read*, n
    allocate(a(n), b(n))
    read*, a(:)
    b(:)=0
    do i=n, 1,-1
        all = 0
        do j=i,n,i
            if (b(j) == 1) all = all + 1
        end do
        if (mod(all,2) /= mod(a(i),2)) b(i) = 1
    end do

    print'(i0)', sum(b(:))
    do i=1,n
        if (b(i)==1) write(*,'(i01x)',advance='no') i 
    end do
    write(*,*)
end program preparing_boxes