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
            all = xor(all,b(j))
        end do
        b(i) = xor(a(i),all)
    end do

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