import sys

import numpy as np



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N = ir()

A = np.array([0] + lr())

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

    a = A[i]

    result = A[i::i].sum()

    if result % 2 != a:

        A[i] = 1 - a



B = np.where(A == 1)[0]

print((len(B)))

print((*B))

import sys



sr = lambda: sys.stdin.readline().rstrip()

ir = lambda: int(sr())

lr = lambda: list(map(int, sr().split()))



N = ir()

A = [0] + lr()

# 後ろから決める、愚直にやって計算時間はNlogN

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

    result = sum(A[i::i]) % 2

    if A[i] != result:

        A[i] = 1 - A[i]



print((sum(A)))

print((*[i for i, x in enumerate(A) if x]))

import sys
import numpy as np

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = np.array([0] + lr())
for i in range(N // 2, 0, -1):
    a = A[i]
    result = A[i::i].sum()
    if result % 2 != a:
        A[i] = 1 - a
B = np.where(A == 1)[0]
print((len(B)))
print((*B))

import sys

sr = lambda: sys.stdin.readline().rstrip()
ir = lambda: int(sr())
lr = lambda: list(map(int, sr().split()))
N = ir()
A = [0] + lr()
# 後ろから決める、愚直にやって計算時間はNlogN
for i in range(N, 0, -1):
    result = sum(A[i::i]) % 2
    if A[i] != result:
        A[i] = 1 - A[i]
print((sum(A)))
print((*[i for i, x in enumerate(A) if x]))

-import numpy as np -A = np.array([0] + lr()) -for i in range(N // 2, 0, -1): -    a = A[i] -    result = A[i::i].sum() -    if result % 2 != a: -        A[i] = 1 - a -B = np.where(A == 1)[0] -print((len(B))) -print((*B)) +A = [0] + lr() +# 後ろから決める、愚直にやって計算時間はNlogN +for i in range(N, 0, -1): +    result = sum(A[i::i]) % 2 +    if A[i] != result: +        A[i] = 1 - A[i] +print((sum(A))) +print((*[i for i, x in enumerate(A) if x]))