N = int(eval(input()))

a = [int(i) for i in input().split()]



b = [0]*N

ans = []

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

    s = 0

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

        s += b[j-1]

    if s % 2 != a[i-1]:

        b[i-1] += 1

        ans.append(i)



print((sum(b)))

if len(ans) > 0:

    print((*ans))
import sys

read = sys.stdin.read

readline = sys.stdin.readline

readlines = sys.stdin.readlines



def main():

    N = int(readline())

    A = [int(i) for i in readline().split()]



    ans = []

    B = [0] * N

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

        s = sum(B[i::i+1])

        if s % 2 == A[i]:

            continue

        else:

            B[i] += 1

            ans.append(i+1)

    

    print((sum(B)))



    if len(ans):

        print((*ans))





if __name__ == "__main__":

    main()

N = int(eval(input()))
a = [int(i) for i in input().split()]
b = [0] * N
ans = []
for i in range(N, 0, -1):
    s = 0
    for j in range(i, N + 1, i):
        s += b[j - 1]
    if s % 2 != a[i - 1]:
        b[i - 1] += 1
        ans.append(i)
print((sum(b)))
if len(ans) > 0:
    print((*ans))

import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines


def main():
    N = int(readline())
    A = [int(i) for i in readline().split()]
    ans = []
    B = [0] * N
    for i in reversed(list(range(N))):
        s = sum(B[i :: i + 1])
        if s % 2 == A[i]:
            continue
        else:
            B[i] += 1
            ans.append(i + 1)
    print((sum(B)))
    if len(ans):
        print((*ans))


if __name__ == "__main__":
    main()

-N = int(eval(input())) -a = [int(i) for i in input().split()] -b = [0] * N -ans = [] -for i in range(N, 0, -1): -    s = 0 -    for j in range(i, N + 1, i): -        s += b[j - 1] -    if s % 2 != a[i - 1]: -        b[i - 1] += 1 -        ans.append(i) -print((sum(b))) -if len(ans) > 0: -    print((*ans)) +import sys + +read = sys.stdin.read +readline = sys.stdin.readline +readlines = sys.stdin.readlines + + +def main(): +    N = int(readline()) +    A = [int(i) for i in readline().split()] +    ans = [] +    B = [0] * N +    for i in reversed(list(range(N))): +        s = sum(B[i :: i + 1]) +        if s % 2 == A[i]: +            continue +        else: +            B[i] += 1 +            ans.append(i + 1) +    print((sum(B))) +    if len(ans): +        print((*ans)) + + +if __name__ == "__main__": +    main()