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

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

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

m = 0
do i = n, 1, -1
   if (mod(dp(i),2) == a(i)) then
      continue
   else
      m = m + 1
      ball(m) = i
      dp(1) = dp(1) + 1
      do j = 2, i/2
         if (mod(i,j) == 0) then
            dp(j) = dp(j) + 1
         endif
      enddo
   endif
enddo

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