There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N).  For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.  We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:    * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.  Does there exist a good set of choices? If the answer is yes, find one good set of choices.
#######################################
import numpy as np
import math
import copy
import re
import sys
#sys.exit(0)

inf = float("inf")
prime = 1

def check_print(check_flag, text, end="\n"):
  if check_flag:
    print(text, end=end)

def c2i(x):
    if str.isdecimal(x):
        return int(x)
    else:
        return x

def cout(*args):
  arglist = []
  for arg in args:
    if hasattr(arg, "__iter__"):
      arglist.extend(arg)
    else:
      arglist.append(arg)
      
  arglist = list(map(str, arglist))
  print(" ".join(arglist))
  
def count2(num):
  count=0
  while num%2==0:
    num/=2
    count+=1
  return count

def ketasum(num):
  nums = [int(s) for s in str(num)]
  return sum(nums)

#math
def gcd(a, b): 
  while b:
    a, b = b, a % b
  return a

def lcm(a, b): 
  return a * b // gcd (a, b)

def gcd3(lis): (3over)
  ans = lis[0]
  for li in lis:
    ans = gcd(ans,li)

def lcm3(lis): (3over)
  ans = lis[0]
  for li in lis:
    ans = lcm(ans,li)

def divisor(n): 
  i = 1
  table = []
  while i * i <= n:
    if n%i == 0:
      table.append(i)
      table.append(n//i)
    i += 1
  table = list(set(table))
  return table

def prime_decomposition(n):
  i = 2
  table = []
  while i * i <= n:
    while n % i == 0:
      n /= i
      table.append(i)
    i += 1
  if n > 1:
    table.append(n)
  return table

def is_prime(n):
  for i in range(2, n + 1):
    if i * i > n:
      break
    if n % i == 0:
      return False
  return n != 1

#input stock


#processing stock






#math


#######################################
n = int(input())
a = np.array(list(map(int, input().split())))
ret = np.array([-1]*n)

mid = int(n/2)

for i in range(n):
  i_idx, i_val = n-i-1, n-i
  idx = [j for j in range(n) if (j+1)%i_val==0]
  idx2 = [j for j in range(n) if (j+1)%i_val==0 and ret[j]==-1]
  idx3 = [j for j in range(n) if (j+1)%i_val==0 and ret[j]!=-1]
  idx = np.array(idx)
  idx2 = np.array(idx2)
  idx3 = np.array(idx3)

  if len(idx)==1:
    ret[i_idx] = a[i_idx]
  elif len(idx2)==1:
    ret[i_idx] = (sum(a[idx]) - sum(a[idx3]))%2
  
cout(ret)

  
  
#######################################
import numpy as np
#######################################
n = int(input())
a = list(map(int, input().split()))
ret = np.zeros(n+1, dtype="int")
ret2 = []

for i in reversed(list(range(n))): 
  if sum(ret[::i+1][1:])%2 != a[i]:
    ret[i+1] = 1
    ret2.append(i+1)

print(sum(ret[1:]))
print(" ".join(list(map(str, ret2[::-1]))))