implicit none
integer :: n
integer,allocatable :: a(:)
integer :: i,j,m,s
integer,allocatable :: ball(:)

read *,n
allocate(a(n))
read *,(a(i),i=1,n)

allocate(ball(n))
ball(:) = 0

do i = n, 1, -1
   s = 0
   do j = 2*i, n, i
      s = xor(s,ball(j))
   enddo
   ball(i) = xor(s,a(i))
enddo

m = sum(ball)

write(*,'(i0)') m
if (m > 0) then
   s = 0
   do i = 1, n
      if (ball(i) == 1) then
         if (s == 0) then
            s = 1
         else
            write(*,'(a)',advance='no') ' '
         endif
         write(*,'(i0)',advance='no') i
      endif
   enddo
   write(*,'(a)') ''
endif
end