program main 
 implicit none
 integer N,M,d,i,j,k
 integer, allocatable::a(:),b(:),c(:)
 read(*,*) N
 allocate(a(1:N), b(1:N))
 read(*,*) a
 M = 0
 do i=1,n
  b(i) = 0
 end do
 
 do i=n,1,-1
  d = N / i
  k = 0
  do j=d,1,-1
   k = mod(k + b(j),2)
  end do
  if(k /= a(i)) then
   b(i) = 1
   M = M+1
  end if
 end do
 write(*,*) M
 
 allocate(c(1:M))
 j = 1
 do i=1,N
  if(b(i) == 1) then
   c(j) = i
   j=j+1
  end if
 end do
 write(*,*) c
end program main