program main
 implicit none
 integer*8 N,M,i,j,d,k
 integer*8, allocatable::a(:),b(:)
 read(*,*) N
 allocate(a(1:N),b(1:N))
 read(*,*) a
 
 M=0
 do i=N/2+1,N
  b(i) = a(i)
  if(a(i) == 1) M = M+1
 end do
 
 do i=N/2,1,-1
  d = N/i
  k=0
  do j=2,d
   k = mod(k + b(i*j),2)
  end do
  b(i) = mod(a(i) + k,2)
  if(b(i) == 1) M = M+1
 end do
 write(*,*) M
! write(*,*) b
 do i=1,N
  if(b(i) == 1) write(*, '(i11)', advance="NO") i
 end do
end program main