module queue
  implicit none
  type :: JagArray
    integer,allocatable :: array(:)
  end type JagArray
  contains
  subroutine push(A,b)
    integer,allocatable,dimension(:)::A
    integer::b
    A=[A,b]
  end subroutine
  subroutine pop(A)
  	integer,allocatable,dimension(:)::A
    A=A(2:)
  end subroutine
end module queue

use queue
integer N
integer,allocatable,dimension(:)::A,B,C
integer presum
read*,N
allocate(A(N),B(N))
read*,A
B=0
C=[integer::]
if(A(N)==1)then
  B(N)=1
  C=[N,c]
endif
do i=n-1,1,-1
  presum=0
  j=i+i
  do while(j<=N)
    presum=presum+B(j)
    j=j+i
  end do
  if(mod(presum+A(i),2)/=0)then
    B(i)=1
    C=[i,c]
  endif
end do
print"(I0)",size(c)
do i=1,size(c)
  if(i==1)then
  write(*,'(i0)', advance='no')c(i)
  else
  write(*,'(x,i0)', advance='no')c(i)
  endif
end do
end