import sys

sys.setrecursionlimit(10000000)

input=sys.stdin.readline



n = int(eval(input()))

a = list(map(int, input().split()))



b=[0]*n



for i in range(n-1,-1,-1):

    if sum(b[i:n:i+1]) %2 and a[i] == 0:

        b[i] = 1 

    elif not sum(b[i:n:i+1]) %2 and a[i] == 1:

        b[i] = 1 





print((sum(b)))

print((" ".join([str(k+1)  for k,v in enumerate(b)  if v== 1])))
import sys

sys.setrecursionlimit(10000000)

input=sys.stdin.readline



n = int(eval(input()))

a = list(map(int, input().split()))



b=[0]*n



for i in range(n-1,-1,-1):

    if sum(b[i:n:i+1]) %2 ^ a[i]:

        b[i] = 1 





print((sum(b)))

print((" ".join([str(k+1)  for k,v in enumerate(b)  if v== 1])))
import sys

sys.setrecursionlimit(10000000)
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * n
for i in range(n - 1, -1, -1):
    if sum(b[i : n : i + 1]) % 2 and a[i] == 0:
        b[i] = 1
    elif not sum(b[i : n : i + 1]) % 2 and a[i] == 1:
        b[i] = 1
print((sum(b)))
print((" ".join([str(k + 1) for k, v in enumerate(b) if v == 1])))

import sys

sys.setrecursionlimit(10000000)
input = sys.stdin.readline
n = int(eval(input()))
a = list(map(int, input().split()))
b = [0] * n
for i in range(n - 1, -1, -1):
    if sum(b[i : n : i + 1]) % 2 ^ a[i]:
        b[i] = 1
print((sum(b)))
print((" ".join([str(k + 1) for k, v in enumerate(b) if v == 1])))

-    if sum(b[i : n : i + 1]) % 2 and a[i] == 0: -        b[i] = 1 -    elif not sum(b[i : n : i + 1]) % 2 and a[i] == 1: +    if sum(b[i : n : i + 1]) % 2 ^ a[i]: