100 atcoder#ABC134D. [ABC134D] Preparing Boxes

[ABC134D] Preparing Boxes

Score : 400400 points

Problem Statement

There are NN empty boxes arranged in a row from left to right. The integer ii is written on the ii-th box from the left (1iN)(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 ii between 11 and NN (inclusive), the total number of balls contained in the boxes with multiples of ii written on them is congruent to aia_i modulo 22.

Does there exist a good set of choices? If the answer is yes, find one good set of choices.

Constraints

  • All values in input are integers.
  • 1N2×1051 \leq N \leq 2 \times 10^5
  • aia_i is 00 or 11.

Input

Input is given from Standard Input in the following format:

NN

a1a_1 a2a_2 ...... aNa_N

Output

If a good set of choices does not exist, print -1.

If a good set of choices exists, print one such set of choices in the following format:

MM

b1b_1 b2b_2 ...... bMb_M

where MM denotes the number of boxes that will contain a ball, and b1, b2, ..., bMb_1,\ b_2,\ ...,\ b_M are the integers written on these boxes, in any order.

3
1 0 0
1
1

Consider putting a ball only in the box with 11 written on it.

  • There are three boxes with multiples of 11 written on them: the boxes with 11, 22, and 33. The total number of balls contained in these boxes is 11.
  • There is only one box with a multiple of 22 written on it: the box with 22. The total number of balls contained in these boxes is 00.
  • There is only one box with a multiple of 33 written on it: the box with 33. The total number of balls contained in these boxes is 00.

Thus, the condition is satisfied, so this set of choices is good.

5
0 0 0 0 0
0

Putting nothing in the boxes can be a good set of choices.