N=int(input())

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



ans=[0]*(N+1)



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

    cnt=0

    for j in range(i*2,N+1,i):

        cnt+=ans[j]

    ans[i]=cnt&1^A[i-1]



print(sum(ans))

for i in range(1,N+1):

    if ans[i]:

        print(i,end=' ')

import sys

input = sys.stdin.readline



def main():

    N = int(eval(input()))

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

    lst = b[:]

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

        j = i

        a = 0

        while j <=N: a, j = a^lst[j-1], j+i

        lst[i-1] = a

    ans = [i+1 for i in range(N) if lst[i]]

    print((len(ans)))

    print((*ans))

    



if __name__ == '__main__':

    main()
N = int(input())
A = list(map(int, input().split()))
ans = [0] * (N + 1)
for i in range(N, 0, -1):
    cnt = 0
    for j in range(i * 2, N + 1, i):
        cnt += ans[j]
    ans[i] = cnt & 1 ^ A[i - 1]
print(sum(ans))
for i in range(1, N + 1):
    if ans[i]:
        print(i, end=" ")

import sys

input = sys.stdin.readline


def main():
    N = int(eval(input()))
    b = list(map(int, input().split()))
    lst = b[:]
    for i in range(N, 0, -1):
        j = i
        a = 0
        while j <= N:
            a, j = a ^ lst[j - 1], j + i
        lst[i - 1] = a
    ans = [i + 1 for i in range(N) if lst[i]]
    print((len(ans)))
    print((*ans))


if __name__ == "__main__":
    main()

-N = int(input()) -A = list(map(int, input().split())) -ans = [0] * (N + 1) -for i in range(N, 0, -1): -    cnt = 0 -    for j in range(i * 2, N + 1, i): -        cnt += ans[j] -    ans[i] = cnt & 1 ^ A[i - 1] -print(sum(ans)) -for i in range(1, N + 1): -    if ans[i]: -        print(i, end=" ") +import sys + +input = sys.stdin.readline + + +def main(): +    N = int(eval(input())) +    b = list(map(int, input().split())) +    lst = b[:] +    for i in range(N, 0, -1): +        j = i +        a = 0 +        while j <= N: +            a, j = a ^ lst[j - 1], j + i +        lst[i - 1] = a +    ans = [i + 1 for i in range(N) if lst[i]] +    print((len(ans))) +    print((*ans)) + + +if __name__ == "__main__": +    main()