There are N empty boxes arranged in a row from left to right. The integer i is written on the i-th box from the left (1 \leq i \leq N).  For each of these boxes, Snuke can choose either to put a ball in it or to put nothing in it.  We say a set of choices to put a ball or not in the boxes is good when the following condition is satisfied:    * For every integer i between 1 and N (inclusive), the total number of balls contained in the boxes with multiples of i written on them is congruent to a_i modulo 2.  Does there exist a good set of choices? If the answer is yes, find one good set of choices.
import sys

input = lambda: sys.stdin.readline().rstrip()


def solve():

    N = int(input())
    A = [0] + list(map(int, input().split()))

    oe = [0] + [-1 for i in range(N)]

    for i in range(N, 0, -1):
        num = i
        j = 1
        flag = True if A[i] == 0 else False
        while num <= N:
            if oe[num] == -1:
                oe[num] = flag
            else:
                f = True if oe[num] == 0 else False
                flag = not(flag ^ f)
            j += 1
            num = i * j

    oe.pop(0)
    oe = [0 if f else 1 for f in oe]
    print(N)
    print(' '.join(map(str, oe)))


if __name__ == '__main__':
    solve()

import sys
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7


def main():
    N = int(readline())
    A = [0] + list(map(int, readline().split()))
    B = [0] * (N + 1)
    ans = []
    for i in range(N, 0, -1):
        x = sum(B[i::i])
        if x % 2 == A[i]:
            continue
        else:
            B[i] = 1
            ans.append(str(i))
    print(len(ans))
    print(' '.join(ans))


if __name__ == '__main__':
    main()
