N = int(input())

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

ans_list = [0] * (N)

ans = []

for i in range(N):

    summ = 0

    j = N - i

    while j < N:

        j = j + N - i

        if j - 1 < N:

            summ += ans_list[j-1]

    if (summ % 2) != arr[N - i - 1]:

        ans_list[N - i - 1] = 1

        ans.append(N - i)



ans.sort()

print(len(ans))

for i in range(len(ans)):

    if i == len(ans)-1:

        print(ans[i])

    else:

        print(ans[i],'', end="")











N = int(eval(input()))

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

ans = [0]*N

for i in range(N):

    target = N-1-i

    tmp = 0

    for k in range(target,N,target+1):

        tmp += ans[k]

    if tmp % 2 == arr[target]:

        ans[target] = 0

    else:

        ans[target] = 1

ans2 = []

for i in range(N):

    if ans[i] == 1:

        ans2.append(i+1)

print((len(ans2)))

print((*ans2))
N = int(input())
arr = list(map(int, input().split()))
ans_list = [0] * (N)
ans = []
for i in range(N):
    summ = 0
    j = N - i
    while j < N:
        j = j + N - i
        if j - 1 < N:
            summ += ans_list[j - 1]
    if (summ % 2) != arr[N - i - 1]:
        ans_list[N - i - 1] = 1
        ans.append(N - i)
ans.sort()
print(len(ans))
for i in range(len(ans)):
    if i == len(ans) - 1:
        print(ans[i])
    else:
        print(ans[i], "", end="")

N = int(eval(input()))
arr = list(map(int, input().split()))
ans = [0] * N
for i in range(N):
    target = N - 1 - i
    tmp = 0
    for k in range(target, N, target + 1):
        tmp += ans[k]
    if tmp % 2 == arr[target]:
        ans[target] = 0
    else:
        ans[target] = 1
ans2 = []
for i in range(N):
    if ans[i] == 1:
        ans2.append(i + 1)
print((len(ans2)))
print((*ans2))

-N = int(input()) +N = int(eval(input())) -ans_list = [0] * (N) -ans = [] +ans = [0] * N -    summ = 0 -    j = N - i -    while j < N: -        j = j + N - i -        if j - 1 < N: -            summ += ans_list[j - 1] -    if (summ % 2) != arr[N - i - 1]: -        ans_list[N - i - 1] = 1 -        ans.append(N - i) -ans.sort() -print(len(ans)) -for i in range(len(ans)): -    if i == len(ans) - 1: -        print(ans[i]) +    target = N - 1 - i +    tmp = 0 +    for k in range(target, N, target + 1): +        tmp += ans[k] +    if tmp % 2 == arr[target]: +        ans[target] = 0 -        print(ans[i], "", end="") +        ans[target] = 1 +ans2 = [] +for i in range(N): +    if ans[i] == 1: +        ans2.append(i + 1) +print((len(ans2))) +print((*ans2))