program A319D
    implicit none
    integer(8)::N,calc,i,j,bcount
    integer(8),allocatable,dimension(:)::A,ans
    read*,N
    allocate(A(N))
    allocate(ans(N))
    read*,A
    ans=0
    bcount=0
    do i=0,N-1
        calc=0
        do j=1,N/(N-i)
            calc=calc+ans(j*(N-i))
        end do
        if(A(N-i)==0)then
            if(mod(calc,2)==1)then
                ans(N-i)=1
                bcount=bcount+1
            end if
        else
            if(mod(calc,2)==0)then
                ans(N-i)=1
                bcount=bcount+1
            end if
        end if
    end do

    print'(i0)',bcount
    do i=1,N
        if(ans(i)==1)write(*,fmt='(i0,1x)',advance='no')i
    end do
    print'(A)',""
end program A319D