program abc134d
    use,intrinsic :: iso_fortran_env
    implicit none
    integer(int32):: n,i,j,cnt
    integer(int32), allocatable:: a(:)
    integer(int32), allocatable:: box(:)

    read*, n
    allocate(a(n))
    allocate(box(n),source=0)
    read*, a(:)

    do i=n,1,-1
        cnt=0
        j = i
        do while(j <= n)
            cnt=cnt+box(j)
            j=j+i
        end do
        if (mod(cnt,2) /= a(i)) box(i) = 1
    end do

    print'(i0)', sum(box)
    do i=1,n
        if (box(i) == 1) print'(i0)', i
    end do

end program abc134d