N = int(eval(input()))

A = [None] + [int(i) for i in input().split()]

ans = []

choose = [0] * (N+1)



for n in range(N, 0, -1):

  x = sum(choose[2*n::n])

  if x % 2 == A[n]:

    continue

  choose[n] += 1  

  ans.append(str(n))



print((len(ans)))

print((' '.join(ans)))
import sys

sys.setrecursionlimit(10 ** 7)

read = sys.stdin.buffer.read 

inp = sys.stdin.buffer.readline

def inpS(): return inp().rstrip().decode()

readlines = sys.stdin.buffer.readlines 

MOD = 10**9+7



N = int(inp())

A = [0] + list(map(int, inp().split()))



# A[i]余りが1: sum(A[i::i])が奇数

for i in range(N//2, 0, -1):

  A[i] = sum(A[i::i])&1

  

ans = [i for i, a in enumerate(A) if a]  



print((len(ans)))

if len(ans) > 0:

  print((*ans))

  
N = int(eval(input()))
A = [None] + [int(i) for i in input().split()]
ans = []
choose = [0] * (N + 1)
for n in range(N, 0, -1):
    x = sum(choose[2 * n :: n])
    if x % 2 == A[n]:
        continue
    choose[n] += 1
    ans.append(str(n))
print((len(ans)))
print((" ".join(ans)))

import sys

sys.setrecursionlimit(10**7)
read = sys.stdin.buffer.read
inp = sys.stdin.buffer.readline


def inpS():
    return inp().rstrip().decode()


readlines = sys.stdin.buffer.readlines
MOD = 10**9 + 7
N = int(inp())
A = [0] + list(map(int, inp().split()))
# A[i]余りが1: sum(A[i::i])が奇数
for i in range(N // 2, 0, -1):
    A[i] = sum(A[i::i]) & 1
ans = [i for i, a in enumerate(A) if a]
print((len(ans)))
if len(ans) > 0:
    print((*ans))

-N = int(eval(input())) -A = [None] + [int(i) for i in input().split()] -ans = [] -choose = [0] * (N + 1) -for n in range(N, 0, -1): -    x = sum(choose[2 * n :: n]) -    if x % 2 == A[n]: -        continue -    choose[n] += 1 -    ans.append(str(n)) +import sys + +sys.setrecursionlimit(10**7) +read = sys.stdin.buffer.read +inp = sys.stdin.buffer.readline + + +def inpS(): +    return inp().rstrip().decode() + + +readlines = sys.stdin.buffer.readlines +MOD = 10**9 + 7 +N = int(inp()) +A = [0] + list(map(int, inp().split())) +# A[i]余りが1: sum(A[i::i])が奇数 +for i in range(N // 2, 0, -1): +    A[i] = sum(A[i::i]) & 1 +ans = [i for i, a in enumerate(A) if a] -print((" ".join(ans))) +if len(ans) > 0: +    print((*ans))