program main
  implicit none
  integer :: n, i
  integer, allocatable :: a(:), b(:)
  read (*, *) n
  allocate (a(n), b(n))
  read (*, *) a
  b(:) = 0
  do i = n, 1, -1
    if (mod(sum(b(i:n:i)), 2) /= a(i)) b(i) = 1
  end do
  write (*, "(i0)") sum(b)
  do i = 1, n
    if (b(i) == 1) write (*, "(i0)") i
  end do
end program main
