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: interview

Starter code:

Solutions:
N = int(input())
A = tuple(map(int, input().split(' ')))

bits = [0] * (N + 1)

i = N
while i > 0:
    j = i
    ones = 0
    while j <= N:
        ones += bits[j]
        j += i
    if ones % 2 != A[i - 1]:
        bits[i] = 1
    i -= 1

indexes = []
for i in range(1, N + 1):
    if bits[i] == 1:
        indexes.append(i)

print((len(indexes)))
if indexes:
    print((*indexes))


# -*- coding: utf-8 -*-
import sys
from collections import deque, defaultdict
from math import sqrt, factorial, gcd, ceil, atan, pi
def input(): return sys.stdin.readline()[:-1] # warning not \n
# def input(): return sys.stdin.buffer.readline().strip() # warning bytes
# def input(): return sys.stdin.buffer.readline().decode('utf-8')
import string
# string.ascii_lowercase
from bisect import bisect_left, bisect_right
from functools import lru_cache
MOD = int(1e9)+7
INF = float('inf')


def solve():
    n = int(input())
    a = [int(x) for x in input().split()]
    xd = [0] * n
    ans = []
    for i in range(n-1,-1,-1):
        cnt = 0
        for j in range(i, n, i + 1):
            cnt += xd[j]
        cnt %= 2
        if cnt != a[i]:
            ans.append(i + 1)
            xd[i] = 1
    ans.reverse()
    print((len(ans)))
    if ans:
        print((*ans))
        

    
t = 1
# t = int(input())
for case in range(1,t+1):
    ans = solve()


"""


"""


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

X = [0 for _ in range(N)]
ans = []
for i in range(N)[::-1]:
    v = 0
    for j in range(i, N, i+1):
        v += X[j]
    if v % 2 != A[i]:
        X[i] = 1
        ans.append(i+1)

print((len(ans)))
for i in ans:
    print(i)


# import itertools
# import math
# import sys
# sys.setrecursionlimit(500*500)
# import numpy as np
# import heapq
# from collections import deque
# import sympy

N = int(input())
# S = input()
# n, *a = map(int, open(0))
# N, M = map(int, input().split())
A = list(map(int, input().split()))
# B = list(map(int, input().split()))
# tree = [[] for _ in range(N + 1)]
# B_C = [list(map(int,input().split())) for _ in range(M)]
# S = input()

# B_C = sorted(B_C, reverse=True, key=lambda x:x[1])
# all_cases = list(itertools.permutations(P))
# a = list(itertools.combinations_with_replacement(range(1, M + 1), N))
# itertools.product((0,1), repeat=n)

# A = np.array(A)
# cum_A = np.cumsum(A)
# cum_A = np.insert(cum_A, 0, 0)

# def dfs(tree, s):
#     for l in tree[s]:
#         if depth[l[0]] == -1:
#             depth[l[0]] = depth[s] + l[1]
#             dfs(tree, l[0])
# dfs(tree, 1)

# def factorization(n):
#     arr = []
#     temp = n
#     for i in range(2, int(-(-n**0.5//1))+1):
#         if temp%i==0:
#             cnt=0
#             while temp%i==0:
#                 cnt+=1
#                 temp //= i
#             arr.append([i, cnt])
#     if temp!=1:
#         arr.append([temp, 1])
#     if arr==[]:
#         arr.append([n, 1])
#     return arr

A.insert(0, 0)
B = [0] * (N + 1)

for i in range(N, 0, -1):
    j = 1
    cnt = 0
    while(i * j <= N):
        cnt += B[i * j]
        j += 1
    flg = cnt % 2
    if A[i] != flg:
        B[i] = 1

# print(B)
print(sum(B))
for i, b in enumerate(B):
    if b == 1:
        print(i)

#入力
n=int(input())
a=list(map(int,input().split()))
#dpテーブル dp[i-1]はi番目の箱に入っているボールの数
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 = [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())
arr = list(map(int, input().split()))
count = 0
arr3 = [0]*n
arr5 = []
if list(set(arr)) == [0]:
    print(0)
    return
for j in range(n, 0, -1):
    cancer = 0
    pre = 0
    for k in range(j, n+1, j):
        pre += arr3[k - 1]
    if pre % 2 != arr[j-1]:
        count += 1
        arr5.append(j)
        arr3[j-1] += 1
print(count)
for aa in arr5:
    print(aa)

N = int(input())
Ali = list(map(int,input().split()))
bli = [0]*(N+1)
M = 0

for z in range(N):
  i = N-z
  #iの倍数の箱の和%2がAliと同じか調べる
  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=" ")

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())
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())
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=" ")

'''
研究室PCでの解答
'''
import math
#import numpy as np
import queue
import bisect
from collections import deque,defaultdict
import heapq as hpq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
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 i in range(n)]
B[n//2:]=A[n//2:]

for i in range(n//2,0,-1):
    B[i-1]= (sum(B[i*2-1::i])%2 != A[i-1])

print(sum(B))
for i,j in enumerate(B):
    if j==1:
        print(i+1)

N = int(input())
a = list(map(int, input().split()))

# 1開始にする
A = [0]+a
# いい入れ方（1はボールが入っている）
B = [0]*(N+1)
# ボールが入っている箱の番号
ans = []

# Nから1までループ
for i in range(N, 0, -1):
    # iの1つ目の倍数からNまでの倍数の箱にボールが入っている箱の個数を求める
    tmp = 0
    for j in range(i*2, N+1, i):
        tmp += B[j]

    # 合計%2がA[i]と不一致ならボールを入れる
    if tmp % 2 != A[i]:
        B[i] = 1
        ans.append(i)

if len(ans) == 0:
    print((0))
else:
    print((len(ans)))
    print((' '.join(map(str, 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]
  else:
    if (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())
bits = list(map(int,input().split()))
ans = set()
for i in reversed(range(n)):
  for j in range(i+(i+1),n,i+1):
    bits[i] ^= bits[j]
  if bits[i] == 1:
    ans.add(i+1)
print(len(ans))
print(*ans)

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 = int(input())
a = list(map(int, input().split()))
a = [0] + a
l = [0]*(n + 1)

for i in range(n, 0, -1):
    if i > 0 - -n//2:
        l[i] = a[i]
    else:
        if a[i] != sum(l[i::i])%2:
            l[i] = 1

print(l.count(1))

for i in range(1, n + 1):
    if l[i] == 1:
        print(i)

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

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

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)

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
for i in range(N):
  tmp = 0
  n = N-i
  for j in range(n*2-1, N, n):
    if b[j] == 1:
      tmp += 1
  if a[n-1] != tmp%2:
    b[n-1] = 1

ans = []
for i in range(N):
  if b[i] == 1:
    ans.append(i+1)
if ans != []:
  print(len(ans))
  print(*ans)
else:
  print(0)

def solve():
    n = int(input())
    a = list(map(int, input().split()))

    ans = set()
    
    for i in range(n, 0, -1):
        now = 0
        for j in range(2*i, n+1, i):
            if j in ans:
                now += 1
        if now % 2 != a[i-1]:
            ans.add(i)
    
    return ans

def __starting_point():
    x = solve()
    print(len(x))
    print(*x, sep=' ')
__starting_point()

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,=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 = list(map(int,input().split()))
b = [0] * N
ans = 0 
from collections import deque        
ansL = deque()
for i in range(N):
    m = N - i 
    count = 0
    for k in range(1,N//m+1):
        count += b[m*k-1]
    if count % 2 != a[m-1]:
        b[m-1] = 1
        ans += 1
        ansL.appendleft(m)    
print(ans)
print((*ansL)) 
    



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 + 1)

for i in range(N, 0, -1):
    if sum(b[::i]) % 2 != a[i-1]:
        b[i] = 1

s = sum(b)
print(sum(b))
if s != 0:
    for i in range(N+1):
        if b[i] == 1:
            print(i, end=" ")

import sys

input = sys.stdin.readline


def main():
    N = int(input())
    a = tuple(map(int, input().split()))

    b = []
    box = [0] * (N + 1)
    for i, r in zip(reversed(list(range(1, N + 1))), a[::-1]):
        total_r = sum(box[j] for j in range(i, N + 1, i)) % 2
        if r == 0 and total_r == 1:
            box[i] = 1
            b.append(i)
        elif r == 1 and total_r == 0:
            box[i] = 1
            b.append(i)

    M = len(b)
    if M == 0:
        print((0))
    else:
        print(M)
        print((" ".join(map(str, b))))


def __starting_point():
    main()

__starting_point()

n=int(input())
a=list(map(int,input().split()))

ans=[0 for _ in range(n+1)]
t=[]
S=0

for i in range(n):
  b=n-i
  c=(n-i)*2
  ch=0
  while c<=n:
    ch+=ans[c]
    c+=b
    
  if ch%2==0:
    if a[b-1]==1:
      ans[b]+=1
      S+=1
      t.append(str(b))
  else:
    if a[b-1]==0:
      ans[b]+=1
      S+=1
      t.append(str(b))
      

print(S)
if S>0:
  
  print((' '.join(t)))


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
    else:
        if 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))

import sys
n = int(input())
a = list(map(int, input().split()))
b = [0 for _ in range(n)]

for i in range(n, 0, -1):
    val = 0
    for j in range(i, n+1, i):
        val += b[j-1]
    if val%2 != a[i-1]:
        b[i-1] += 1

num = sum(b)
if num == 0:
    print((0))
else:
    print(num)
    for i in range(n):
        if b[i] != 0:
            print((i+1))
            


import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    
    n = I()
    a = [0] + LI()
    ans = [0 for _ in range(n+1)]

    for i in range(n,0,-1):
        cnt = 0
        for j in range(i,n+1,i):
            cnt += ans[j]
        if cnt%2 != a[i]:
            ans[i] = 1
    
    ans_lst = []
    for i in range(1,n+1):
        if ans[i] == 1:
            ans_lst.append(i)

    print((len(ans_lst)))
    print((*ans_lst))

    
main()


n = int(input())
b = list(map(int, input().split()))
a = [0] * (n + 1)
for i in range(1, n + 1):
    a[i] = b[i - 1]


ball = [0] * (n + 1)
ans = []

for i in range(n, 0, -1):
    s = 0
    j = i * 2
    while j <= n:
        s += ball[j]
        j += i

    if s % 2 != a[i]:
        ball[i] += 1
        ans.append(i)

print((len(ans)))
for e in ans:
    print(e)


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 = int(input())
a = list(map(int, input().split()))

b = [0] * n
c = []
for i in range(n-1, -1, -1):
    v = i + 1
    s = 0
    for j in range(1, 10**6):
        if v*j > n:
            break    
        s += b[v*j-1]
    if s % 2 != a[i]:
        b[i] = 1
        c.append(v)
print(len(c))
for i in reversed(c):
    print(i)

n=int(input())
a=list(map(int,input().split()))
d=[0 for i in range(n+1)]
ans=[0 for i in range(n+1)]
for i in range(n,0,-1):
  c=0
  for j in range(i*2,n+1,i):
    c+=ans[j]
  if (c%2)^a[i-1]:
    ans[i]=1

r=""
c=0
for i in range(1,n+1):
  if ans[i]:
    c+=1
    r+=str(i)+" "
print(c)
print((r[:-1]))
  


import sys,math,collections,itertools
input = sys.stdin.readline

N = int(input())
a = list(map(int,input().split()))
a.insert(0,0)
b = []
c = [0 for _ in range(N+1)]
for i in range(N,0,-1):
    cnt = 0
    for j in range(2*i,N+1,i):
        if c[j] == 1:
            cnt +=1
    if (cnt%2==1 and a[i] == 0) or (cnt%2==0 and a[i] == 1):
        b.append(i)
        c[i] = 1
print((len(b)))
print((*b))


def resolve():
    '''
    code here
    '''
    N = int(input())
    As = [int(item) for item in input().split()]

    box = set()

    for i in range(N):
        num = N -i
        sum_num  = 0
        for j in range(1, N//num +1):
            if j*num in box:
                sum_num += 1

        if As[num-1] != sum_num % 2:
            box.add(num)

    print((len(box)))

    for item in box:
        print(item)

def __starting_point():
    resolve()

__starting_point()

n =int(input())
A = list(map(int,input().split()))

B = [0]*n

for i in range(n)[::-1]:
  tmp = 0
  j = i+1
  
  while j<=n:    
    tmp += B[j-1]
    j += i+1
    
  if tmp%2 != A[i]:    
    B[i] = 1

print(sum(B))
print(*[i+1 for i in range(n) if B[i]])

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) 

import sys
# import math
# import bisect
# import numpy as np
# from decimal import Decimal
# from numba import njit, i8, u1, b1 #JIT compiler
# from itertools import combinations, product
# from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_ints2(x):   return map(lambda num: int(num) - x, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def GCD(a: int, b: int) -> int: return b if a%b==0 else GCD(b, a%b)
def LCM(a: int, b: int) -> int: return (a * b) // GCD(a, b)

def Main():
    n = read_int()
    a = read_int_list()
    b = [0] * n
    ans = []
    for i in range(n - 1, -1, -1):
        if sum(b[i::i + 1]) % 2 != a[i]:
            b[i] = 1
            ans.append(i + 1)
    print(len(ans))
    if len(ans): print(*ans)    
    
def __starting_point():
    Main()
__starting_point()

N=int(input())
A=[0] + list(map(int,input().split()))
B=[0]*(N+1)#ボールの管理

#大きい数字から1まで順に見ていく
for i in reversed(range(1,N+1)):
  ball=0
  base=i+1

  #iからNまでiずつ見てボールを足す(j=iの倍数)
  for j in range(i,N+1,i):
    ball+=B[j]

  #もし足したボールの数%2がA[i]と合わないなら合わせる
  if ball%2 != A[i]:
    B[i] = 1

print(sum(B))#ボールの入った箱の総数
#もしBに1が入っている場所があればその場所を出力
print(*[i for i,b in enumerate(B) if b==1],sep=' ')

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()

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

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 =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]              
    else:      
      if 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()))
A=[0]+A
B=[0]*(N+1)
for i in range(N):
  k=N-i 
  c=0
  for j in range(k,N+1,k):
    c+=B[j]
    c%=2
  if A[k]!=c:
    B[k]=1
    
print(sum(B))
for i in range(len(B)):
  if B[i]==1:
    print(i)

#!/usr/bin/env python3
n = int(input())
*a, = list(map(int, input().split()))
b = [0]*(n//2) + a[n//2:]
for i in reversed(list(range(n//2))):
    b[i] = sum(b[(i+1)*(j+1)-1] for j in range(n//(i+1)))&1 ^ a[i]
print((sum(b)))
print((*[i+1 for i in range(n) if b[i]==1]))


N = int(input())
a = list(map(int, input().split()))

box = [-1] * (N + 1)
ball_in_list = []
# 箱について(i = N, N-1, ..., 1)
for i in range(N, 0, -1):
    cnt = 0
    # (N//i)*i, ..., 3*i, 2*i
    for j in range((N // i) * i, 2 * i - 1, -i):
        cnt += box[j]

    # 偶奇が同じならボールは入れない
    if cnt % 2 == a[i - 1]:
        box[i] = 0
    # 偶奇が異なる時、ボールを入れる、その行為を記録
    else:
        box[i] = 1
        ball_in_list.append(i)

print((len(ball_in_list)))
print((*ball_in_list))


n=int(input())
a=list(map(int,input().split()))

ans=[]
b=[0]*n
for i in reversed(list(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()))
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])

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 = list(map(int,input().split()))

ans = [0] * N
for i,a in enumerate(A[::-1]):
    n = m = N-i
    s = 0
    while m <= N:
        s += ans[m-1]
        m += n
    ans[n-1] = (s%2)^a

ans = [i+1 for i,a in enumerate(ans) if a]
print(len(ans))
if ans:
    print(*ans, sep='\n')

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")    

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())
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 = int(input())
A = list(map(int, input().split()))

import numpy as np
B = [0 for _ in range(n)]
ans = []
for i, a in enumerate(A[::-1]):
  i = len(A) - i - 1
  B[i] = int(np.array(B[i::i+1]).sum() % 2 != a)
  if B[i] == 1:
    ans.append(i+1)
print(len(ans))
if len(ans) > 0:
  print(*ans)

n = int(input())
a = list(map(int,input().split()))
box = set([])
for i in range(n,0,-1):
  cnt = 0
  for j in range(1,n//i+1):
    if i*j in box:
      cnt += 1
  if cnt%2 != a[i-1]:
    box.add(i)
print(len(box))
print(*box)

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

for i in range(N - 1, -1, -1):
    B[i] = (sum(B[2 * (i + 1) - 1::i + 1]) % 2) ^ A[i]

print(sum(B))
print(*[i+1 for i in range(N) if B[i] == 1])

import math
from math import gcd,pi,sqrt
INF = float("inf")
MOD = 10**9 + 7

import sys
sys.setrecursionlimit(10**6)
import itertools
import bisect
from collections import Counter,deque
def i_input(): return int(input())
def i_map(): return map(int, input().split())
def i_list(): return list(i_map())
def i_row(N): return [i_input() for _ in range(N)]
def i_row_list(N): return [i_list() for _ in range(N)]
def s_input(): return input()
def s_map(): return input().split()
def s_list(): return list(s_map())
def s_row(N): return [s_input for _ in range(N)]
def s_row_str(N): return [s_list() for _ in range(N)]
def s_row_list(N): return [list(s_input()) for _ in range(N)]


def main():
    M = i_input()
    B = [0] + i_list()

    N = [0]*(M+1)
    for i in range(M,0,-1):
        k = 2*i
        trial = 0
        while k <= M:
             trial += N[k]
             k += i
        if trial % 2 == B[i]:
            continue
        else:
            N[i] = 1
    s = sum(N)
    print(s)
    if s > 0:
        for i,k in enumerate(N):
            if k > 0:
                print(i)


 
def __starting_point():
    main()
__starting_point()

n = int(input())
a = [0] + list(map(int, input().split()))
b = [0]*(n+1)
b[-1] = a[-1]
ans = []
for i in range(n, 0, -1):
    cnt = 0
    bi = i
    i += bi
    while i <= n:
        cnt += b[i]
        i += bi

    if (cnt%2) == a[bi]:
        b[bi] = 0
    else:
        b[bi] = 1
        ans.append(bi)

print(len(ans))
if ans:
    print(*ans)

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

# 1からNまでの数字それぞれの約数を求める
# Nから(大きい値から)見ていき、1であれば入れる
# 数字iを入れた場合、iの約数の数を+1
# それぞれの数はdictで保持する

N = int(input())
A = list(map(int, input().split()))

ans = [0 for _ in range(N)]

ans_num = 0
ans_list = ""
for i in range(N):
    tmp = N - i
    s = 0
    for j in range(tmp, N+1, tmp):
        s += ans[j-1]

    if s % 2 != A[tmp - 1]:
        ans[tmp - 1] = 1
        ans_num += 1
        ans_list += str(tmp)
        ans_list += " "


print(ans_num)
print(ans_list[:-1])

n = int(input())
alst = list(map(int, input().split()))
divisor_lst = [[0] for _ in range(n)]
ans = []
for i in range(2, n + 1):
    for k in range(i * 2, n + 1, i):
        divisor_lst[k - 1].append(i - 1)
for i in range(n - 1, -1, -1):
    if alst[i] == 1:
        for j in divisor_lst[i]:
            alst[j] += 1
            alst[j] %= 2
        ans.append(i + 1)
print(len(ans))
print(*ans)

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_)))
        






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)

N, *A = list(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 = [int(x) for x in input().split()]
m = []
for i in range(n, 0, -1):
    t = 0
    for j in range(i, n + 1, i):
        t = t + a[j-1]
    if t % 2 != a[i-1]:
        if a[i-1] == 1:
            a[i-1] = 0
        else:
            a[i-1] = 1
    if a[i-1] == 1:
        m.append(i)
print(len(m))
for i in m:
    print(i)
    print(" ")

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 = [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))))


#!/usr/bin/env python3
n = int(input())
*a, = list(map(int, input().split()))
b = [0]*(n//2) + a[n//2:]
for i in reversed(list(range(n//2))):
    b[i] = sum(b[(i+1)*(j+1)-1] for j in range(n//(i+1)))%2 ^ a[i]
print((sum(b)))
print((*[i+1 for i in range(n) if b[i]==1]))


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()

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

def __starting_point():
    main()
__starting_point()

N = int(input())
A = list(map(int, input().split()))
res = [-1]*N

for i in reversed(range(1, N + 1)):
    p = (N // i) * i
    s = 0
    while res[p - 1] != -1:
        s += res[p - 1]
        s %= 2
        p -= i
    res[p - 1] = (A[p - 1] - s) % 2

print(sum(res))
for i in range(N):
    if res[i] == 1:
        print(i + 1)

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
    # print(i)
    for j in range(i,n+1,i):
        # print(i,j)
        tmp += dp[j]
    # print(111,tmp,A[i],i)
    if A[i]!=(tmp%2):
        # print(i)
        dp[i] = 1
l = []
# print(dp)
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 = list(map(int,input().split()))
ans = [0 for i in range(N+1)]

for i in range(N,0,-1):
    res = 0
    for j in range(1,N+1):
        if i*j>N:
            break
        else:
            res += ans[i*j]
      
    if res%2 != a[i-1]:
        ans[i] += 1
        
print((sum(ans)))
A = []
for i,v in enumerate(ans):
    if v>0:
        A.append(i)
        
        
print((*A))
    






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()


import sys

input = sys.stdin.readline


def main():
    N = int(input())
    a = list(map(int, input().split()))

    b = []
    box = [0] * (N + 1)
    for i, r in zip(reversed(list(range(1, N + 1))), a[::-1]):
        total_r = sum(box[j] for j in range(i, N + 1, i)) % 2
        if r == 0 and total_r == 1:
            box[i] = 1
            b.append(i)
        elif r == 1 and total_r == 0:
            box[i] = 1
            b.append(i)

    M = len(b)
    if M == 0:
        print((0))
    else:
        print(M)
        print((" ".join(map(str, b))))


def __starting_point():
    main()

__starting_point()

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,*a=map(int,open(0).read().split())
b=[0]*(n+1)
for i in range(1,n+1)[::-1]:
 b[i]+=(sum(b[j] for j in range(i,n+1,i))+a[i-1])%2
print(sum(b))
print(*[i for i in range(n+1) if b[i]>0])

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())
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 = list(map(int, input().split()))
ans = [0]*n
for i in range(n-1, -1, -1):
    count = 0
    for j in range(i, n, i+1):
        count += ans[j]
    if count % 2 != a[i]:
        ans[i] = 1

if sum(ans) == 0:
    print(0)
    return

print(sum(ans))
for i in range(n):
    if ans[i] == 1:
        print(i+1, end=" ")


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)

icase=0
if icase==0:
    n=int(input())
    a=[0]+list(map(int,input().split()))
elif icase==3:
    f=open(r"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]
#    print(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(i,b[i],a[i],asum)
    
print(sum(b))
for i in range(1,len(b)):
    if b[i]==1:
        print(i,end=" ")
print(" ")

N = int(input())
aaa = list(map(int, input().split()))
M = 0
bbb = [0] * (N + 1)
for i in range(N, 0, -1):
    if (aaa[i-1] + sum(bbb[i::i])) % 2 == 1:
        M += 1
        bbb[i] = 1
print(M)
if M > 0:
    ans = [i for i, b in enumerate(bbb) if b]
    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,*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))

#!/usr/bin/env python
# coding: utf-8

# In[3]:


N = int(input())
a = list(map(int, input().split()))


# In[6]:


mylist = [0]*(N+1)
i = N
while i > 0:
    idx = i
    x = 0
    while idx <= N:
        x += mylist[idx]
        idx += i
    if x%2 != a[i-1]:
        mylist[i] = 1
    i -= 1
ans = []
for i in range(1,N+1):
    if mylist[i] == 1:
        ans.append(i)
print((len(ans)))
if ans:
    print((*ans))


# In[ ]:






#import math
#import itertools
#import numpy as np
#from collections import deque
# sys.setrecursionlimit(10 ** 6)
#mod = 10 ** 9 + 7
#INF = 10 ** 9
#PI = 3.14159265358979323846

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())
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()))

# 箱に書かれた数字が大きい順にボールを入れるか決定していくとi以上のiの倍数
# についてはすでにボールを入れるか入れないかを決定している

ans = [0] * N
for i in range(N - 1, -1, -1):
    if (i == N - 1):
        if (a[i] == 0):
            continue
        else:
            ans[i] = 1
            continue

    elif (i == 0):
        sum_a = sum(ans)
    else:
        sum_a = sum(ans[i::(i + 1)])

    if (a[i] == 0 and sum_a % 2 == 0):
        continue
    elif(a[i] == 0 and sum_a % 2 == 1):
        ans[i] = 1
    elif (a[i] == 1 and sum_a % 2 == 0):
        ans[i] = 1
    elif (a[i] == 1 and sum_a % 2 == 1):
        continue
    else:
        print((-1))
        return

M = 0
new_ans = []
for i in range(N):
    if (ans[i] == 1):
        M += 1
        new_ans.append(i + 1)

if (M == 0):
    print(M)
    return
print(M)
print((*new_ans))


import sys


def IN_I(): return int(sys.stdin.readline().rstrip())
def IN_LI(): return list(map(int, sys.stdin.readline().rstrip().split()))
def IN_S(): return sys.stdin.readline().rstrip()
def IN_LS(): return list(sys.stdin.readline().rstrip().split())


N = IN_I()
a = [0] + IN_LI()
b = [0] * (N + 1)
ans = []

for i in range(N, 0, -1):
    tmp = 0
    for j in range(2 * i, N + 1, i):
        tmp += b[j]
    if tmp % 2 != a[i]:
        b[i] = 1
        ans.append(i)
if len(ans) == 0:
    print((0))
else:
    print((len(ans)))
    print((' '.join(map(str, ans))))