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.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq N \leq 2 \times 10^5
 - a_i is 0 or 1.

-----Input-----
Input is given from Standard Input in the following format:
N
a_1 a_2 ... a_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:
M
b_1 b_2 ... b_M

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

-----Sample Input-----
3
1 0 0

-----Sample Output-----
1
1

Consider putting a ball only in the box with 1 written on it.
 - There are three boxes with multiples of 1 written on them: the boxes with 1, 2, and 3. The total number of balls contained in these boxes is 1.
 - There is only one box with a multiple of 2 written on it: the box with 2. The total number of balls contained in these boxes is 0.
 - There is only one box with a multiple of 3 written on it: the box with 3. The total number of balls contained in these boxes is 0.
Thus, the condition is satisfied, so this set of choices is good.

Difficulty: MEDIUM

Solutions:
N = int(input())
A = list(map(int, input().split()))
A = [0] + A
for i in range(N // 2, 0, -1):
	A[i] = sum(A[i::i]) % 2
ans = [i for i in range(N + 1) if A[i]]
print(len(ans))
print(*ans)


n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n, 0, -1):
	if sum(b[i - 1::i]) % 2 == a[i - 1]:
		continue
	else:
		b[i - 1] = 1
b_index = [i + 1 for i in range(n) if b[i] == 1]
print(sum(b))
print(*b_index)


import sys
input = sys.stdin.readline
N = int(input())
a = [0] + list(map(int, input().split()))
for i in range(N, 0, -1):
	a[i] = sum(a[i::i]) % 2
print(sum(a))
del a[0]
for (i, v) in enumerate(a):
	if v == 1:
		print(i + 1, end=' ')


N = int(input())
A = list(map(int, input().split()))
boxes = [0] * N
for i in range(N)[::-1]:
	s = sum(boxes[i::i + 1])
	if s % 2 != A[i]:
		boxes[i] = 1
M = sum(boxes)
print(M)
if M != 0:
	print(*[i + 1 for (i, j) in enumerate(boxes) if j == 1])


import math
import queue
import bisect
from collections import deque, defaultdict
import heapq as hpq
from sys import stdin, setrecursionlimit
ipt = stdin.readline
setrecursionlimit(10 ** 7)
mod = 10 ** 9 + 7

def main():
	n = int(ipt())
	a = [int(i) for i in ipt().split()]
	p2 = [0] * (n + 1)
	for i in range(n, 0, -1):
		sm = 0
		for j in range(i, n + 1, i):
			sm += p2[j]
		p2[i] = (a[i - 1] - sm) % 2
	sm = sum(p2)
	print(sm)
	ans = []
	for (i, pi) in enumerate(p2):
		if pi:
			ans.append(str(i))
	print(' '.join(ans))
	return None

def __starting_point():
	main()
__starting_point()


n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(n)]
for i in range(n - 1, -1, -1):
	tmp = 0
	for j in range(2 * (i + 1) - 1, n, i + 1):
		tmp ^= b[j]
	b[i] = a[i] ^ tmp
ans = [i + 1 for i in range(n) if b[i]]
print(len(ans))
print(*ans)


n = int(input())
a = list(map(int, input().split()))
ans = [0] * (n + 1)
for i in range(n, 0, -1):
	temp = 0
	for j in range(i, n + 1, i):
		temp += ans[j]
	if a[i - 1] != temp % 2:
		ans[i] = 1
print(sum(ans))
for i in range(n + 1):
	if ans[i] == 1:
		print(i, end=' ')


N = int(input())
a = list(map(int, input().split()))
t = [0] * N
for i in range(N - 1, -1, -1):
	t[i] = sum(t[2 * (i + 1) - 1::i + 1]) % 2 ^ a[i]
print(sum(t))
print(*[i + 1 for i in range(N) if t[i] == 1])


n = int(input())
a = [int(i) for i in input().split()]
a = [0] + a
for i in range(n, 0, -1):
	a[i] = sum(a[i::i]) % 2
ans = []
for i in range(len(a)):
	if a[i] == 1:
		ans.append(i)
print(len(ans))
if len(ans) != 0:
	print(' '.join(map(str, ans)))


n = int(input())
a = [int(x) for x in input().split()]
b = [0] * n
c = []
for i in range(n):
	if sum(b[n - i - 1:n:n - i]) % 2 != a[n - i - 1]:
		b[n - i - 1] += 1
		c.append(n - i)
print(len(c))
print(' '.join(map(str, c[::-1])))


N = int(input())
A = list(map(int, input().split()))
L = A[:]
for i in range(N // 2, 0, -1):
	x = N // i
	s = sum([L[i * k - 1] for k in range(1, x + 1)]) % 2
	if L[i - 1] != s:
		L[i - 1] = s
print(sum(L))
L = [str(i + 1) for (i, c) in enumerate(L) if c == 1]
print(' '.join(L))


icase = 0
if icase == 0:
	n = int(input())
	a = [0] + list(map(int, input().split()))
elif icase == 3:
	f = open('C:\\Users\\nishi\\999atcoder\\ABCD040-151\\ABC134D\\testcase_12.in')
	ll = f.readline()
	n = int(ll)
	ll = f.readline()
	a = [0] + list(map(int, ll.split()))
	f.close()
b = [0] * (n + 1)
for i in range(n // 2 + 1, n + 1):
	b[i] = a[i]
for i in range(n // 2, 0, -1):
	i2 = i * 2
	asum = 0
	while i2 <= n:
		asum += b[i2]
		i2 += i
	b[i] = (asum + a[i]) % 2
print(sum(b))
for i in range(1, len(b)):
	if b[i] == 1:
		print(i, end=' ')
print(' ')


n = int(input())
a = [int(i) for i in input().split()]
cnt = [0] * n
for i in range(n, 0, -1):
	total = sum((cnt[i * k - 1] for k in range(1, n // i + 1)))
	if total % 2 != a[i - 1]:
		cnt[i - 1] = 1
b = [i + 1 for i in range(n) if cnt[i] > 0]
print(sum(cnt))
print(*b)


n = int(input())
l = list(map(int, input().split()))
for i in range(n, 0, -1):
	l[i - 1] = sum(l[i - 1::i]) % 2
print(sum(l))
print(*[i + 1 for i in range(n) if l[i]])


n = int(input())
a = [0] + list(map(int, input().split()))
b = [0] * (n + 1)
for i in reversed(range(1, n + 1)):
	if sum(b[i::i]) % 2 != a[i]:
		b[i] = 1
print(sum(b))
for (i, j) in enumerate(b):
	if j == 1:
		print(i, end=' ')


n = int(input())
a = [0] + list(map(int, input().split()))
b = [0] * (n + 1)
for i in range(n, 0, -1):
	p = 0
	for t in range(i * 2, n + 1, i):
		p += b[t]
	b[i] = p % 2 ^ a[i]
print(sum(b))
print(' '.join(map(str, [i for i in range(1, n + 1) if b[i]])))


N = int(input())
A = list(map(int, input().split()))
A.insert(0, 0)
ball = [0] * (N + 1)
M = 0
ans = []
for i in reversed(range(1, N + 1)):
	j = 2
	total = 0
	while i * j <= N:
		total += ball[i * j]
		j += 1
	if total % 2 != A[i]:
		ball[i] = 1
		M += 1
for i in range(1, N + 1):
	if ball[i] == 1:
		ans.append(i)
print(M)
print(*ans)


N = int(input())
A = ['*'] + list(map(int, input().split()))
B = ['*'] + list([0] * N)
for k in range(N, 0, -1):
	p = A[k]
	for i in range(2 * k, N + 1, k):
		p ^= B[i]
	B[k] = p
C = [k for k in range(1, N + 1) if B[k]]
print(len(C))
if C:
	print(' '.join(map(str, C)))


n = int(input())
a = list(map(int, input().split()))
b = a.copy()
for i in range(n // 2, 0, -1):
	if a[i - 1] != sum(b[i - 1::i]) % 2:
		b[i - 1] = 1 - a[i - 1]
print(sum(b))
print(*(i + 1 for (i, x) in enumerate(b) if x))


def main():
	import sys

	def input():
		return sys.stdin.readline().rstrip()
	n = int(input())
	a = [0] + list(map(int, input().split()))
	for i in range(n, 0, -1):
		k = 1
		flag = 0
		while i * k <= n:
			flag ^= a[i * k]
			k += 1
		if flag != a[i]:
			a[i] ^= 1
	ans = [i for i in range(n + 1) if a[i] == 1]
	if ans == []:
		print(0)
	else:
		print(len(ans))
		print(*ans)

def __starting_point():
	main()
__starting_point()


n = int(input())
a = [0] + list(map(int, input().split()))
for i in range(n // 2, 0, -1):
	a[i] = sum(a[i::i]) % 2
s = [i for (i, b) in enumerate(a) if b]
print(len(s))
print(*s)


n = int(input())
a = [0] + list(map(int, input().split()))
b = [0] * (n + 1)
for i in reversed(list(range(1, n + 1))):
	ans = 0
	for j in range(i, n + 1, i):
		ans += b[j]
	if ans % 2 == a[i]:
		b[i] = 0
	else:
		b[i] = 1
c_ = []
for (c, d) in enumerate(b):
	if d == 1:
		c_.append(str(c))
print(len(c_))
print(' '.join(c_))


import sys
input = sys.stdin.readline
N = int(input().rstrip('\n'))
As = [int(x) for x in input().rstrip('\n').split()]
res = [0] * N
for i in range(N, 0, -1):
	now = sum(res[i - 1::i]) % 2
	if now != As[i - 1]:
		res[i - 1] += 1
print(sum(res))
print(*[x + 1 for x in range(N) if res[x] > 0])


(n, *a) = map(int, open(0).read().split())
a = [0] + a
b = [0] * -~n
for i in range(n, 0, -1):
	s = sum((b[j] for j in range(i, n + 1, i)))
	if s % 2 != a[i]:
		b[i] = 1
print(sum(b))
print(*[i for (i, b) in enumerate(b) if b == 1])


N = int(input())
a = list(map(int, input().split()))
b = []
dp = [0] * (N + 1)
ans = 0
for i in range(N, 0, -1):
	p = 0
	for j in range(1, N // i + 1):
		p += dp[j * i]
	if p % 2 != a[i - 1]:
		dp[i] = 1
		ans += 1
		b.append(i)
b.sort()
print(ans)
print(*b)


import math
N = int(input())
a = [0] + list(map(int, input().split()))
for i in range(1, N + 1)[::-1]:
	a[i] = sum(a[i::i]) % 2
ans = [index for (index, v) in enumerate(a) if v == 1]
print(len(ans))
print(*ans)


N = int(input())
A = [0] + list(map(int, input().split()))
B = [0] * (N + 1)
for i in reversed(range(1, N + 1)):
	ball = 0
	base = i + 1
	for j in range(i, N + 1, i):
		ball += B[j]
	if ball % 2 != A[i]:
		B[i] = 1
print(sum(B))
print(*[i for (i, b) in enumerate(B) if b == 1], sep=' ')


(n, *a) = map(int, open(0).read().split())
b = [0] * n
for i in range(1, n + 1)[::-1]:
	if not sum(b[i - 1::i]) % 2 == a[i - 1]:
		b[i - 1] = 1
print(sum(b))
print(*[i + 1 for (i, b_i) in enumerate(b) if b_i == 1])


n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for i in range(n - 1, -1, -1):
	x = sum(ans[i::i + 1]) % 2
	if x != a[i]:
		ans[i] = 1
print(sum(ans))
for i in range(n):
	if ans[i] == 1:
		print(str(i + 1) + ' ', end='')


N = int(input())
a = [0] + list(map(int, input().split()))
b = [0 for _ in range(N + 1)]
for i in reversed(range(1, N + 1)):
	tmp = 0
	for j in range(i, N + 1, i):
		tmp += b[j]
	if tmp % 2 == a[i]:
		b[i] = 0
	else:
		b[i] = 1
ans = []
for (i, j) in enumerate(b):
	if j == 1:
		ans.append(i)
print(len(ans))
if len(ans):
	print(*ans)


N = int(input())
Alist = list(map(int, input().split()))
Answer = [0] * (N + 1)
M = 0
for i in range(1, len(Alist) + 1):
	A = Alist[-i]
	n = N + 1 - i
	if sum(Answer[n::n]) % 2 != A:
		Answer[-i] = 1
		M += 1
print(M)
Ans = []
for k in range(len(Answer)):
	if Answer[k] == 1:
		Ans.append(k)
print(*Ans[0:], end='\t')


N = int(input())
A = list(map(int, input().split()))
b = [0 for _ in range(N)]
for i in range(N, 0, -1):
	b[i - 1] = 0 if sum(b[i - 1::i]) % 2 == A[i - 1] else 1
ans = [str(i + 1) for (i, x) in enumerate(b) if x == 1]
print(len(ans))
if ans:
	print(' '.join(ans))


N = int(input())
A = [int(_) for _ in input().split()]
cs = [0] * N
for i in range(N):
	j = N - i
	cs[j - 1] = (A[j - 1] + sum(cs[j - 1::j])) % 2
rs = []
for (i, v) in enumerate(cs):
	if v:
		rs.append(i + 1)
print(len(rs))
print(*rs)


n = int(input())
a = list(map(int, input().split()))
l = [-1 for _ in range(n)]
for i in reversed(range(1, n + 1)):
	si = 0
	j = 2 * i - 1
	while j <= n - 1:
		si += l[j]
		j += i
	si = si % 2
	if si == 0:
		l[i - 1] = a[i - 1]
	elif a[i - 1] == 0:
		l[i - 1] = 1
	else:
		l[i - 1] = 0
b = []
for i in range(n):
	if l[i] == 1:
		b.append(i + 1)
print(len(b))
if len(b) != 0:
	print(*b)


def main():
	N = int(input())
	A = reversed(list(map(int, input().split())))
	balls = [0] * (N + 1)
	for (i, a) in enumerate(A):
		s = sum([balls[j] for j in range((N - i) * 2, N + 1, N - i)])
		if a == 1 and s % 2 == 0 or (a == 0 and s % 2 == 1):
			balls[N - i] = 1
	print(sum(balls))
	idx = [str(i) for (i, flag) in enumerate(balls) if flag == 1]
	print(' '.join(idx))

def __starting_point():
	main()
__starting_point()


n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n - 1, -1, -1):
	b[i] = (a[i] + sum(b[i::i + 1])) % 2
l = [x + 1 for (x, y) in enumerate(b) if y == 1]
print(len(l))
print(*l)


N = int(input())
A = [int(x) for x in input().split()]
M = 0
for i in range(N, 0, -1):
	t = 0
	for j in range(i, N + 1, i):
		t += A[j - 1]
	if t % 2 != A[i - 1]:
		A[i - 1] = (A[i - 1] + 1) % 2
	if A[i - 1]:
		M += 1
print(M)
if M > 0:
	for i in range(N):
		if A[i]:
			print(i + 1, '', end='')
	print()


INT = lambda : int(input())
INTM = lambda : map(int, input().split())
STRM = lambda : map(str, input().split())
STR = lambda : str(input())
LIST = lambda : list(map(int, input().split()))
LISTS = lambda : list(map(str, input().split()))

def do():
	n = INT()
	A = LIST()
	flg = True
	la = len(A)
	bool = [False] * (n + 1)
	B = []
	for i in range(la - 1, -1, -1):
		a = A[i]
		s = i + 1
		temp = 0
		for j in range(n // s + 1):
			if j == 0:
				continue
			if bool[j * s]:
				temp += 1
		if temp % 2 != a:
			B.append(s)
			bool[s] = True
	B = sorted(B)
	print(len(B))
	if len(B) != 0:
		print(*B)

def __starting_point():
	do()
__starting_point()


n = int(input())
a = list(map(int, input().split()))
b = [None] * n
for i in range(n, 0, -1):
	s = 0
	for j in range(2 * i, n + 1, i):
		s += b[j - 1]
	b[i - 1] = a[i - 1] ^ s % 2
print(sum(b))
print(*[ind + 1 for (ind, i) in enumerate(b) if i])


n = int(input())
A = list(map(int, input().split()))
dp = [0] * (n + 2)
A = [0] + A
for i in range(n, 0, -1):
	tmp = 0
	for j in range(i, n + 1, i):
		tmp += dp[j]
	if A[i] != tmp % 2:
		dp[i] = 1
l = []
for i in range(1, n + 1):
	if dp[i] == 1:
		l.append(i)
if len(l) == 0:
	print(len(l))
else:
	print(len(l))
	print(*l)


N = int(input())
(*A,) = map(int, input().split())
D = [[1] for _ in range(N + 1)]
for i in range(2, N + 1):
	j = 1
	while i * j <= N:
		D[i * j].append(i)
		j += 1
D = D[1:]
B = [0] * N
ans = []
i = 1
while i <= N:
	B[-i] %= 2
	if B[-i] == A[-i]:
		i += 1
		continue
	else:
		ans.append(N - i + 1)
		for d in D[-i]:
			B[d - 1] += 1
		B[-i] %= 2
	i += 1
M = len(ans)
ans.sort()
print(M)
print(*ans)


n = int(input())
a = input()
r = [None] * (n + 1)
for i in range(n, 0, -1):
	r[i] = (ord(a[2 * i - 2]) + sum(r[i * 2::i])) % 2
print(r.count(1))
print(*(i for (i, x) in enumerate(r) if x))


n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n - 1, -1, -1):
	b[i] = 1 if sum(b[i + i + 1:n:i + 1]) % 2 != a[i] else 0
b = [i + 1 for i in range(n) if b[i] == 1]
m = len(b)
if m == 0:
	print(0)
else:
	print(m)
	print(*b)


N = int(input())
A = [int(a) for a in input().split()]
ANS = [0] * N
for i in range(N)[::-1]:
	ans = A[i]
	for j in range(i + 1, N + 1, i + 1):
		ans ^= ANS[j - 1]
	ANS[i] = ans
print(sum(ANS))
print(*[i + 1 for i in range(N) if ANS[i]])


N = int(input())
a = [0] + list(map(int, input().split()))
b = [0] * (N + 1)
for i in range(N, 0, -1):
	x = sum(b[2 * i::i])
	if x % 2 != a[i]:
		b[i] = 1
print(sum(b))
for i in range(1, N + 1):
	if b[i] == 1:
		print(str(int(i)), end=' ')


N = int(input())
A = list(map(int, input().split()))
d = [0] * N
for i in reversed(range(1, N + 1)):
	n = 1
	t = 0
	while i * n <= N:
		t += d[i * n - 1]
		n += 1
	d[i - 1] = (t + A[i - 1]) % 2
res = [i + 1 for (i, x) in enumerate(d) if x]
print(len(res))
print(*res)


(N, A) = (int(input()), list(map(int, input().split())))
(b, r) = ([0] * N, [])
for (i, x) in enumerate(reversed(A)):
	if not x == sum(b[N - i - 1::N - i]) % 2:
		b[N - 1 - i] = 1
for (i, x) in enumerate(b):
	if x:
		r.append(i + 1)
print(len(r))
print(' '.join(map(str, r)))


N = int(input())
Ali = list(map(int, input().split()))
bli = [0] * (N + 1)
M = 0
for z in range(N):
	i = N - z
	sb = 0
	for j in range(i * 2, N + 1, i):
		sb += bli[j]
	if sb % 2 != Ali[i - 1]:
		bli[i] = 1
		M += 1
print(M)
cnt = 0
for i in range(N + 1):
	if bli[i] == 1:
		cnt += 1
		if cnt == M:
			print(i)
		else:
			print(i, end=' ')


N = int(input())
(*A,) = map(int, input().split())
b = [0] * N
for i in range(N - 1, -1, -1):
	chk = sum(b[i:N:i + 1])
	if chk % 2 ^ A[i]:
		b[i] = 1
print(sum(b))
ans = []
for (i, v) in enumerate(b):
	if v == 1:
		ans.append(i + 1)
print(*ans)


n = int(input())
a = list(map(int, input().split()))
ball = [0 for i in range(n)]
for i in reversed(range(n)):
	if n // 2 < i:
		ball[i] = a[i]
	elif (sum(ball[i::i + 1]) - a[i]) % 2 == 0:
		ball[i] = 0
	else:
		ball[i] = 1
num = [str(i + 1) for (i, x) in enumerate(ball) if x == 1]
if len(num) == 0:
	print('0')
else:
	print(len(num))
	num = ' '.join(num)
	print(num)


n = int(input())
l = list(map(int, input().split()))
box = [0] * (n + 1)
for i in range(n):
	k = n - i
	count = 0
	for j in range(k, n + 1, k):
		count += box[j]
	if count % 2 != l[k - 1]:
		box[k] = 1
ll = []
for i in range(1, n + 1):
	if box[i] == 1:
		ll.append(i)
print(box.count(1))
print(*ll)


n = int(input())
ns = list(map(int, input().split()))
rslt = [0] * n
r = n - 1
while r >= 0:
	if sum(rslt[r:n:r + 1]) % 2 != ns[r]:
		rslt[r] += 1
	r -= 1
print(sum(rslt))
if sum(rslt):
	print(*[i + 1 for (i, num) in enumerate(rslt) if num == 1])


N = int(input())
aN = [int(i) for i in input().split()]
bN = [0] * N
for i in range(N, 0, -1):
	if sum(bN[i - 1::i]) % 2 != aN[i - 1]:
		bN[i - 1] = 1
print(sum(bN))
if sum(bN) != 0:
	print(*[i + 1 for (i, b) in enumerate(bN) if b == 1])


n = int(input())
A = list(map(int, input().split()))
ans = [0] * n
for i in range(n)[::-1]:
	if i >= n // 2:
		ans[i] = A[i]
	else:
		tmp = 0
		j = i + 1
		while j <= n:
			tmp += ans[j - 1]
			j += i + 1
		if A[i] == 1:
			if tmp % 2 != A[i]:
				ans[i] = A[i]
		elif tmp % 2 == 1:
			ans[i] = 1
print(sum(ans))
print(*[i + 1 for i in range(n) if ans[i] == 1])


n = int(input())
a = list(map(int, input().split()))
for i in range(n - 1, -1, -1):
	s = sum(a[i::i + 1])
	if s % 2 != a[i]:
		a[i] = 1 - a[i]
print(a.count(1))
print(*[i + 1 for (i, x) in enumerate(a) if x])


N = int(input())
A = [0] + list(map(int, input().split()))
Ans = [0] * (N + 1)
for (i, a) in zip(list(range(N, 0, -1)), A[:0:-1]):
	n = 0
	for aj in Ans[i * 2::i]:
		n ^= aj
	Ans[i] = n ^ a
Ans = [i for (i, a) in enumerate(Ans[1:], 1) if a]
print(len(Ans))
print(' '.join(map(str, Ans)))


n = int(input())
a = list(map(int, input().split()))
b = [0] * n
for i in range(n - 1, -1, -1):
	if a[i] != sum(b[i::i + 1]) % 2:
		b[i] = 1
ans = [i for (i, x) in enumerate(b) if x == 1]
print(len(ans))
for i in ans:
	print(i + 1, end=' ')


N = int(input())
A = [0] + [int(s) for s in input().split()]
ball = [0] * (N + 1)
for i in range(N, 0, -1):
	ball[i] = (sum(ball[i::i]) - A[i]) % 2
ans = [i for (i, v) in enumerate(ball) if v == 1]
print(len(ans))
print(*ans)


N = int(input())
A = list(map(int, input().split()))
B = [0] * N
for i in range(N - 1, -1, -1):
	tmp_sum = 0
	for j in range((i + 1) * 2 - 1, N, i + 1):
		tmp_sum += B[j]
		tmp_sum %= 2
	B[i] = tmp_sum ^ A[i]
print(sum(B))
print(*[i + 1 for (i, b) in enumerate(B) if b == 1])


(N, *a) = map(int, open(0).read().split())
for i in range(N)[::-1]:
	part_rem = sum(a[i::i + 1]) % 2
	if a[i] != part_rem:
		a[i] = abs(a[i] - 1)
print(sum(a))
print(*[i + 1 for (i, v) in enumerate(a) if v == 1])


(n, *a) = map(int, open(0).read().split())
b = [0] * (n + 1)
for x in range(n, 0, -1):
	b[x] = (sum(b[x::x]) + a[x - 1]) % 2
print(b.count(1))
for i in range(n + 1):
	if b[i]:
		print(i, end=' ')


N = int(input())
A = list(map(int, input().split()))
B = [False] * N
for i in range(N, 0, -1):
	B[i - 1] = A[i - 1] + sum((B[j - 1] for j in range(i * 2, N + 1, i))) & 1
C = [i for (i, a) in enumerate(B, 1) if a]
print(len(C))
print(*C)


n = int(input())
(*a,) = map(int, input().split())
ans = [0] * n
for i in range(n - 1, -1, -1):
	if not sum(ans[i::i + 1]) % 2 == a[i]:
		ans[i] = 1
print(sum(ans))
print(*[i + 1 for i in range(n) if ans[i] == 1])


N = int(input())
A = [0] + list(map(int, input().split()))
ans = [0] * (N + 1)
for i in reversed(range(1, N + 1)):
	tot = 0
	for j in range(i + i, N + 1, i):
		tot += ans[j]
	if tot % 2 != A[i]:
		ans[i] = 1
M = sum(ans)
res = []
for i in range(1, N + 1):
	if ans[i] == 1:
		res.append(str(i))
print(M)
print(' '.join(res))


n = int(input())
v = list(map(int, input().strip().split()))
a = [0] * n
for i in range(n - 1, -1, -1):
	c = 0
	for j in range(i, n, i + 1):
		c ^= a[j]
	if c != v[i]:
		a[i] = 1
ans = []
for i in range(n):
	if a[i]:
		ans.append(i + 1)
print(len(ans))
print(*ans)


n = int(input())
a = [0] + list(map(int, input().split()))
b = []
c = [0] * (n + 1)
for i in range(n, 0, -1):
	cnt = 0
	t = i
	while t <= n:
		cnt += c[t]
		t += i
	if cnt % 2 != a[i]:
		c[i] = 1
		b.append(i)
b.sort()
if len(b) > 0:
	print(len(b))
	print(*b)
else:
	print(0)


n = int(input())
a = list(map(int, input().split()))
ans = a[:]
for i in reversed(range(n)):
	ans[i] = sum(ans[i::i + 1]) % 2
print(sum(ans))
print(*[i + 1 for i in range(n) if ans[i]])


N = int(input())
A = [int(i) for i in input().split()]
B = [0] * N
for i in reversed(range(N)):
	B[i] = (A[i] - sum(B[i::i + 1])) % 2
ans = [i + 1 for (i, b) in enumerate(B) if b == 1]
print(len(ans))
print(*ans)


def main():
	n = int(input())
	a = list(map(int, input().split()))
	ans = [-1 for i in range(n)]
	for i in range(n):
		c = n // (n - i)
		if c < 2:
			if a[n - 1 - i] == 1:
				ans[n - 1 - i] = 1
			else:
				ans[n - 1 - i] = 0
		else:
			s = 0
			for j in range(2, c + 1):
				s += ans[j * (n - i) - 1]
			ans[n - i - 1] = (s + a[n - 1 - i]) % 2
	a = []
	for i in range(n):
		if ans[i] == 1:
			a.append(i + 1)
	if len(a) == 0:
		print(0)
	else:
		print(len(a))
		print(' '.join(list(map(str, a))))

def __starting_point():
	main()
__starting_point()


import math

def main():
	N = int(input())
	A = [int(a) for a in input().split(' ')]
	B = [0] * N
	if N == 1:
		if A[0] == 1:
			print(1)
			print(1)
		else:
			print(0)
		return 0
	for i in range(1, N):
		for j in range(math.ceil(N / (i + 1)), math.floor(N / i) + 1):
			ball = 0
			for k in range(2 * j, N + 1, j):
				ball += B[k - 1]
			B[j - 1] = (ball % 2 + A[j - 1]) % 2
	ans = [str(x + 1) for (x, v) in enumerate(B) if v == 1]
	print(len(ans))
	if len(ans) > 0:
		print(' '.join(ans))
main()


N = int(input())
lsa = list(map(int, input().split()))
ls = [0] * (N + 1)
for i in range(N, 0, -1):
	k = 0
	c = 2 * i
	while c <= N:
		k += ls[c]
		c += i
	if k % 2 == lsa[i - 1] % 2:
		continue
	ls[i] = 1
ls.pop(0)
M = ls.count(1)
print(M)
if M != 0:
	ls1 = []
	for i in range(N):
		if ls[i] == 1:
			ls1.append(i + 1)
	ls2 = [str(i) for i in ls1]
	print(' '.join(ls2))


N = int(input())
A = tuple(map(int, input().split()))
state = [0] * (N + 1)
for i in range(N, 0, -1):
	if N < i + i:
		state[i] = A[i - 1]
	else:
		state[i] = A[i - 1]
		j = i + i
		while j <= N:
			state[i] ^= state[j]
			j += i
ans = [str(i) for (i, x) in enumerate(state) if x == 1]
print(len(ans))
if ans:
	print(' '.join(ans))


n = int(input())
a = [0] + [int(i) for i in input().split()]
b = [0] * (n + 1)
for i in range(1, n + 1)[::-1]:
	mul_sum = sum((b[x] for x in range(i + i, n + 1, i)))
	b[i] = mul_sum % 2 ^ a[i]
print(sum(b))
print(' '.join((str(i) for i in range(1, n + 1) if b[i])))


import math
N = int(input())
A = [0] + list(map(int, input().split()))
B = [0] * (N + 1)
s = 0
for i in reversed(range(1, N + 1)):
	ball = 0
	for j in range(i, N + 1, i):
		ball += B[j]
	if ball % 2 != A[i]:
		B[i] = 1
		s += 1
print(s)
print(*[i for (i, b) in enumerate(B) if b == 1], sep=' ')


N = int(input())
A = list(map(int, input().split()))
B = [0] * (N + 1)
for i in range(N, 0, -1):
	B[i] = sum((B[x] for x in range(i, N + 1, i))) % 2 != A[i - 1]
print(sum(B))
print(*[i for (i, v) in enumerate(B) if v])


n = int(input())
A = list(map(int, input().split()))[::-1]
B = [0] * n
for i in range(n):
	k = n - i
	if A[i] != B[k - 1::k].count(1) % 2:
		B[k - 1] = 1
o = B.count(1)
print(o)
P = [[i + 1 for (i, x) in enumerate(B) if x == 1]]
if o != 0:
	print(*P[0])


n = int(input())
A = list(map(int, input().split()))
B = [0] * (n + 1)
(C, cnt) = ([], 0)
for i in range(1, n + 1)[::-1]:
	sum_list = sum([B[j] for j in range(i, n + 1, i)])
	if sum_list % 2 != A[i - 1]:
		B[i] = 1
		cnt += 1
		C.append(i)
print(cnt)
print(*C[::-1])


n = int(input())
a = list(map(int, input().split()))
res = [0] * n
for i in range(n - 1, -1, -1):
	res[i] = (a[i] + sum(res[2 * i + 1:n:i + 1])) % 2
print(res.count(1))
for i in range(n):
	if res[i] == 1:
		print(i + 1, end=' ')


N = int(input())
arr = [0] + list(map(int, input().split(' ')))
for i in range(N // 2, 0, -1):
	arr[i] = sum(arr[i::i]) % 2
ans = [i for (i, j) in enumerate(arr) if j == 1]
print(len(ans))
print(*ans)


n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(n // 2)] + a[n // 2:]
for i in range(n // 2 - 1, -1, -1):
	b[i] = abs(a[i] - sum(b[i::i + 1]) % 2)
print(sum(b))
print(*[i + 1 for (i, bi) in enumerate(b) if bi > 0])


n = int(input())
a = list(map(int, input().split()))
ans = [False] * n
for i in range(n // 2, n):
	ans[i] = a[i]
for i in range(n // 2 - 1, -1, -1):
	mod = False
	for j in range(i, n, i + 1):
		if ans[j] == 1:
			mod = not mod
	mod = 1 if mod else 0
	ans[i] = True if mod != a[i] else False
cnt = 0
ind = []
for i in range(n):
	if ans[i] == True:
		cnt += 1
		ind.append(i + 1)
print(cnt)
if cnt > 0:
	print(' '.join(map(str, ind)))


n = int(input())
a = list(map(int, input().split()))
r = [None] * (n + 1)
for i in range(n, 0, -1):
	r[i] = (a[i - 1] + sum(r[i * 2::i])) % 2
print(r.count(1))
print(*(i for (i, x) in enumerate(r) if x))


N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
for i in range(N):
	n = N - i
	add = A[n - 1]
	n_tmp = n
	while True:
		n_tmp += n
		if n_tmp > N:
			break
		if ans[n_tmp - 1]:
			add = 0 if add else 1
	if add:
		ans[n - 1] = 1
print(ans.count(1))
ans2 = []
for (i, v) in enumerate(ans):
	if v:
		ans2.append(i + 1)
print(*ans2)


(n, a) = open(0)
n = int(n)
b = [0] * -~n
for x in range(n, 0, -1):
	b[x] = (sum(b[x::x]) + int(a[x * 2 - 2])) % 2
print(sum(b))
print(*[i + 1 for i in range(n) if b[i + 1]])


from copy import deepcopy
N = int(input())
A = list(map(int, input().split()))
ans = [0] * (N // 2 + 1) + A[N // 2:]
A = [0] + A
ok = 1
for i in range(N // 2, 0, -1):
	if sum(ans[i * 2:i * (N // i) + 1:i]) % 2 == 0:
		ans[i] = A[i]
	else:
		ans[i] = 1 - A[i]
ans2 = []
for i in range(1, N + 1):
	if ans[i] == 1:
		ans2.append(i)
print(len(ans2))
if len(ans2) > 0:
	print(*ans2)


n = int(input())
lis = [0] + list(map(int, input().split()))
b = [0] * (n + 1)
for i in reversed(range(1, n + 1)):
	ball = 0
	base = i + 1
	for j in range(i, n + 1, i):
		ball += b[j]
	if ball % 2 != lis[i]:
		b[i] = 1
print(sum(b))
print(*[i for (i, b) in enumerate(b) if b == 1], sep=' ')


N = int(input())
A = list(map(int, input().split()))
A = [0] + A
res = [0] * (N + 1)
M = 0
for i in range(N, 0, -1):
	if sum((res[j] for j in range(i, N + 1, i))) % 2 != A[i]:
		res[i] = 1
		M += 1
print(M)
print(*[k for (k, r) in enumerate(res) if r])


(N, *aa) = map(int, open(0).read().split())
ans = [None] * (N // 2) + aa[N // 2:]
for i in range(N // 2, 0, -1):
	ans[i - 1] = sum(ans[2 * i - 1::i]) % 2 ^ aa[i - 1]
p = sum(ans)
print(p)
if p:
	print(*(i + 1 for (i, v) in enumerate(ans) if v))


n = int(input())
a = list(map(int, input().split()))
b = [0] * n
c = []
for i in reversed(range(n)):
	j = 0
	k = 2
	while k * (i + 1) <= n:
		j = j + b[k * (i + 1) - 1]
		k = k + 1
	j = j % 2
	if a[i] != j:
		b[i] = 1
print(sum(b))
for i in range(n):
	if b[i] == 1:
		print(i + 1, end=' ')


def inpl():
	return list(map(int, input().split()))
N = int(input())
A = [0] + inpl()
D = [0] * (N + 1)
for i in range(N, 0, -1):
	D[i] = sum(D[2 * i::i]) % 2 ^ A[i]
print(sum(D))
print(*[i for i in range(N + 1) if D[i]])


n = int(input())
a = [int(x) for x in input().split()]
for i in range(n, 0, -1):
	a[i - 1] = sum(a[i - 1::i]) % 2
print(sum(a))
print(' '.join([str(i + 1) for (i, j) in enumerate(a) if j == 1]))


n = int(input())
a = list(map(int, input().split()))
ret = [0] * (n + 1)
ret2 = []
for i in reversed(list(range(n))):
	if sum(ret[::i + 1][1:]) % 2 != a[i]:
		ret[i + 1] = 1
		ret2.append(i + 1)
print(sum(ret[1:]))
print(' '.join(list(map(str, ret2[::-1]))))


n = int(input())
list_A = list(map(int, input().split()))
list_N = [0] * n
for i in range(n, 0, -1):
	(k, cnt) = (0, 0)
	while True:
		if k + i > n:
			break
		if list_N[k + i - 1] == 1:
			cnt += 1
		k += i
	list_N[i - 1] = (list_A[i - 1] + cnt) % 2
ans = []
for i in range(n):
	if list_N[i] == 1:
		ans.append(i + 1)
print(len(ans))
print(*ans)


n = int(input())
a = list(map(int, input().split()))
b = [0] * n
ans = 0
for i in range(n)[::-1]:
	t = 0
	j = (i + 1) * 2
	while j <= n:
		t += b[j - 1]
		j += i + 1
	if a[i] == 0:
		if t % 2 == 0:
			b[i] = 0
		else:
			b[i] = 1
			ans += 1
	elif t % 2 == 0:
		b[i] = 1
		ans += 1
	else:
		b[i] = 0
print(ans)
l = []
for i in range(n):
	if b[i] == 1:
		l.append(str(i + 1))
print(' '.join(l))


n = int(input())
a = list(map(int, input().split()))
t = [0] * n
p = []
g = 0
for i in range(n - 1, -1, -1):
	if sum(t[i::i + 1]) % 2 != a[i]:
		t[i] = 1
		p.append(i + 1)
		g += 1
print(g)
print(*p[::-1])


N = int(input())
A = list(map(int, input().split()))
B = (N + 1) * [0]
for n in range(N, 0, -1):
	B[n] = (sum(B[n::n]) + A[n - 1]) % 2
print(B.count(1))
for n in range(N + 1):
	if B[n]:
		print(n, end=' ')


N = int(input())
A = list(map(int, input().split()))
ans = [0] * (N + 1)
for i in range(N, 0, -1):
	cnt = 0
	for j in range(i * 2, N + 1, i):
		cnt += ans[j]
	ans[i] = cnt & 1 ^ A[i - 1]
print(sum(ans))
for i in range(1, N + 1):
	if ans[i]:
		print(i, end=' ')


(N, *A) = map(int, open(0).read().split())
A = [0] + A
B = [0] * (N + 1)
sum_B = 0
for i in range(N, 0, -1):
	if sum((B[j] for j in range(i, N + 1, i))) % 2 != A[i]:
		B[i] = 1
		sum_B += 1
print(sum_B)
print(*[i for (i, b) in enumerate(B) if b])


n = int(input())
a = list(map(int, input().split()))
ans = []
b = [0] * n
for i in reversed(range(n)):
	if sum(b[i::i + 1]) % 2 != a[i]:
		b[i] += 1
		ans.append(i + 1)
print(sum(b))
print(*sorted(ans))


n = int(input())
a = list(map(int, input().split()))
hako = [0] * n
for i in range(n, 0, -1):
	tmp = i
	su = 0
	while tmp <= n:
		su += hako[tmp - 1]
		tmp += i
	if su % 2 == a[i - 1]:
		continue
	else:
		hako[i - 1] = 1
print(hako.count(1))
for i in range(n):
	if hako[i] == 1:
		print(i + 1, end=' ')


N = int(input())
a = [0] + list(map(int, input().split()))
ls = [0] * (N + 1)
for i in range(N, 0, -1):
	sm = 0
	for j in range(i, N + 1, i):
		sm += ls[j]
	ls[i] = sm % 2 ^ a[i]
b = [i for i in range(N + 1) if ls[i] == 1]
print(len(b))
print(*b)


n = int(input())
a = list(map(int, input().split()))
b = []
lst = [0] * n
for (i, x) in reversed(list(enumerate(a))):
	if sum(lst[i::i + 1]) % 2 != x:
		lst[i] += 1
		b.append(i + 1)
print(len(b))
if len(b) > 0:
	print(*reversed(b))


N = int(input())
A = [int(x) for x in input().split()]
B = [0] * N
for i in range(N - 1, -1, -1):
	ai = A[i]
	for j in range(i, N, i + 1):
		ai ^= B[j]
	B[i] = ai
print(sum(B))
if sum(B):
	print(' '.join([str(i + 1) for i in range(N) if B[i]]))


n = int(input())
a = list(map(int, input().split()))
dp = [0 for i in range(n)]
dp[n - 1] = a[n - 1]
for i in range(n, 0, -1):
	num = 0
	for j in range(i * 2, n + 1, i):
		num = num + dp[j - 1]
	if num % 2 == a[i - 1]:
		dp[i - 1] = 0
	else:
		dp[i - 1] = 1
print(dp.count(1))
for i in range(n):
	if dp[i] == 1:
		print(i + 1, end=' ')


N = int(input())
A = list(map(int, input().split()))
ans = [0] * N
index = []
M = 0
for i in range(N - 1, -1, -1):
	a = ans[i:N:i + 1]
	if sum(a) % 2 == A[i]:
		ans[i] = 0
	else:
		ans[i] = 1
		index.append(i + 1)
		M += 1
print(M)
print(*index[::-1])