def main():

    N = int(input())

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



    box = [0] * N

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

        # ボールの総数

        cnt = 0

        # (i + 1)の倍数

        num = i + 1

        while num <= N:

            cnt += box[num - 1]

            num += (i + 1)

        

        if cnt % 2 != A[i]:

            box[i] = 1



    ans = [idx + 1 for idx in range(N) if box[idx]]



    print(len(ans))

    if ans:

        print(*ans, sep=" ")



if __name__ == "__main__":

    main()

N = int(eval(input()))

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



box = [0] * N

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

    cnt = 0

    num = i + 1

    while num <= N:

        cnt += box[num - 1]

        num += i + 1

    

    if cnt % 2 != A[i]:

        box[i] = 1

    

ans = [idx + 1 for idx in range(N) if box[idx]]



print((len(ans)))

print((*ans))
def main():
    N = int(input())
    A = [int(i) for i in input().split()]
    box = [0] * N
    for i in range(N - 1, -1, -1):
        # ボールの総数
        cnt = 0
        # (i + 1)の倍数
        num = i + 1
        while num <= N:
            cnt += box[num - 1]
            num += i + 1
        if cnt % 2 != A[i]:
            box[i] = 1
    ans = [idx + 1 for idx in range(N) if box[idx]]
    print(len(ans))
    if ans:
        print(*ans, sep=" ")


if __name__ == "__main__":
    main()

N = int(eval(input()))
A = [int(i) for i in input().split()]
box = [0] * N
for i in range(N - 1, -1, -1):
    cnt = 0
    num = i + 1
    while num <= N:
        cnt += box[num - 1]
        num += i + 1
    if cnt % 2 != A[i]:
        box[i] = 1
ans = [idx + 1 for idx in range(N) if box[idx]]
print((len(ans)))
print((*ans))

-def main(): -    N = int(input()) -    A = [int(i) for i in input().split()] -    box = [0] * N -    for i in range(N - 1, -1, -1): -        # ボールの総数 -        cnt = 0 -        # (i + 1)の倍数 -        num = i + 1 -        while num <= N: -            cnt += box[num - 1] -            num += i + 1 -        if cnt % 2 != A[i]: -            box[i] = 1 -    ans = [idx + 1 for idx in range(N) if box[idx]] -    print(len(ans)) -    if ans: -        print(*ans, sep=" ") - - -if __name__ == "__main__": -    main() +N = int(eval(input())) +A = [int(i) for i in input().split()] +box = [0] * N +for i in range(N - 1, -1, -1): +    cnt = 0 +    num = i + 1 +    while num <= N: +        cnt += box[num - 1] +        num += i + 1 +    if cnt % 2 != A[i]: +        box[i] = 1 +ans = [idx + 1 for idx in range(N) if box[idx]] +print((len(ans))) +print((*ans))