import heapq
from collections import defaultdict
cnt = defaultdict(int)
N = int(input())
A = list(map(int, input().split()))
# A = []
# for i in range(N):
#     A.append(int(input()))
ans = 0
_ans = []
buff = [0 for i in range(N)]
for i in range(N-1, -1, -1):
    if i > N//2:
        buff[i] = A[i]
    else:
        _m = 0
        # for j in range(i, N, max(1, i)):
        #     _m += buff[j]
        # _m = sum(buff[i:N])
        for j in range(i*2, N, max(1, i)):
            _m += buff[j]
        if _m % 2 != A[i]:
            buff[i] = 1
            ans += 1
            _ans.append(i+1)

mm = 0
for i in range(ans):
    if buff[i] == 1:
        mm = i

print(sum(buff))
print(*_ans)