integer N
integer,allocatable,dimension(:)::A,C
integer i,j,cnt
read*,N
allocate(A(N),C(N))
read*,A
cnt=0
do i=n,1,-1
  if(A(i)/=0)then
    cnt=cnt+1
    c=[i,c]
    do j=1,i
      if(j*j>i)exit
      if(mod(i,j)==0)then
        A(j)=xor(A(j),1)
        if(j*j/=i)A(i/j)=xor(A(i/j),1)
      endif
    end do
  endif
end do
print"(I0)",cnt
do i=1,cnt
  if(i==1)then
  write(*,'(i0)', advance='no')c(i)
  else
  write(*,'(x,i0)', advance='no')c(i)
  endif
end do
end