n = int(eval(input()))

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



B = [0]*n



for i in reversed(list(range(n))):

    j = i+1

    cnt = 0

    while j <= n:

        cnt += B[j-1]

        j += i+1

    if cnt%2 != A[i]:

        B[i] = 1



m = 0

ans = []

for i, b in enumerate(B):

    if b != 0:

        m += 1

        ans.append(i+1)

print(m)

if len(ans) > 0:

    print((*ans))
n =int(eval(input()))

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



ans = [0]*n

for i in reversed(list(range(n))):

    j = i+1

    b = 0

    while j <= n:

        b += ans[j-1]

        j += (i+1)

    if b%2 == A[i]:

        ans[i] = 0

    else:

        ans[i] = 1

print((sum(ans)))

B = []

for i in range(len(ans)):

    if ans[i] != 0:

        B.append(i+1)

print((*B))
n = int(eval(input()))
A = list(map(int, input().split()))
B = [0] * n
for i in reversed(list(range(n))):
    j = i + 1
    cnt = 0
    while j <= n:
        cnt += B[j - 1]
        j += i + 1
    if cnt % 2 != A[i]:
        B[i] = 1
m = 0
ans = []
for i, b in enumerate(B):
    if b != 0:
        m += 1
        ans.append(i + 1)
print(m)
if len(ans) > 0:
    print((*ans))

n = int(eval(input()))
A = list(map(int, input().split()))
ans = [0] * n
for i in reversed(list(range(n))):
    j = i + 1
    b = 0
    while j <= n:
        b += ans[j - 1]
        j += i + 1
    if b % 2 == A[i]:
        ans[i] = 0
    else:
        ans[i] = 1
print((sum(ans)))
B = []
for i in range(len(ans)):
    if ans[i] != 0:
        B.append(i + 1)
print((*B))

-B = [0] * n +ans = [0] * n -    cnt = 0 +    b = 0 -        cnt += B[j - 1] +        b += ans[j - 1] -    if cnt % 2 != A[i]: -        B[i] = 1 -m = 0 -ans = [] -for i, b in enumerate(B): -    if b != 0: -        m += 1 -        ans.append(i + 1) -print(m) -if len(ans) > 0: -    print((*ans)) +    if b % 2 == A[i]: +        ans[i] = 0 +    else: +        ans[i] = 1 +print((sum(ans))) +B = [] +for i in range(len(ans)): +    if ans[i] != 0: +        B.append(i + 1) +print((*B))