N = int(eval(input()))

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

ans =[]



for _ in range(N):

  ans.append(-1)



for i in range(1, N + 1)[::-1]:

  C = i*2

  BALL = A[i-1]

  while C <= N:

    BALL = BALL ^ ans[C-1]

    C += i

  ans[i-1] = BALL 



print((ans.count(1)))

ans2 = []

for i in range(N):

  if ans[i] == 1:

    ans2.append(i+1)



L=[str(a) for a in ans2]

L=" ".join(L)

print(L)

n = int(eval(input()))

nums = list(map(int, input().split()))

ans = []



for _ in range(n):

  ans.append(-1)



for i in range(1, n + 1)[::-1]:

  C = i*2

  BALL = nums[i-1]

  while C <= n:

    BALL = BALL ^ ans[C-1]

    C += i

  ans[i-1] = BALL 



print((ans.count(1)))

ans2 = []

for i in range(n):

  if ans[i] == 1:

    ans2.append(i+1)



L=[str(a) for a in ans2]

L=" ".join(L)

print(L)

N = int(eval(input()))
A = list(map(int, input().split()))
ans = []
for _ in range(N):
    ans.append(-1)
for i in range(1, N + 1)[::-1]:
    C = i * 2
    BALL = A[i - 1]
    while C <= N:
        BALL = BALL ^ ans[C - 1]
        C += i
    ans[i - 1] = BALL
print((ans.count(1)))
ans2 = []
for i in range(N):
    if ans[i] == 1:
        ans2.append(i + 1)
L = [str(a) for a in ans2]
L = " ".join(L)
print(L)

n = int(eval(input()))
nums = list(map(int, input().split()))
ans = []
for _ in range(n):
    ans.append(-1)
for i in range(1, n + 1)[::-1]:
    C = i * 2
    BALL = nums[i - 1]
    while C <= n:
        BALL = BALL ^ ans[C - 1]
        C += i
    ans[i - 1] = BALL
print((ans.count(1)))
ans2 = []
for i in range(n):
    if ans[i] == 1:
        ans2.append(i + 1)
L = [str(a) for a in ans2]
L = " ".join(L)
print(L)

-N = int(eval(input())) -A = list(map(int, input().split())) +n = int(eval(input())) +nums = list(map(int, input().split())) -for _ in range(N): +for _ in range(n): -for i in range(1, N + 1)[::-1]: +for i in range(1, n + 1)[::-1]: -    BALL = A[i - 1] -    while C <= N: +    BALL = nums[i - 1] +    while C <= n: -for i in range(N): +for i in range(n):