program preparing_boxes
  implicit none
  integer :: n, a(200000) = 0, b(200000) = 0, c(200000) = 1, m = 0, s, i
  read(*,*) n
  read(*,*) a(1:n)
  do i = n, 1, -1
    s = sum(c(i:n:i))
    if (mod(s,2) /= a(i)) c(i) = 0
  end do
  do i = 1, n
    if (c(i) == 1) then
      m = m+1
      b(m) = i
    end if
  end do
  write(*,'(i0)') m
  if (s > 0) then
    write(*,'(i0)',advance='no') b(1)
    do i = 2, m
      write(*,'(x,i0)',advance='no') b(i)
    end do
    write(*,*)
  end if
  stop
end program preparing_boxes