n = int(eval(input()))

nums = [int(i) for i in input().split()]

box = [-1] * n

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

    c = i * 2

    ball = nums[i - 1]

    while c <= n:

        ball = ball ^ box[c - 1]

        c += i

    box[i - 1] = ball



ans = box.count(1)

print(ans)

ball = []

for i in range(n):

    if box[i] == 1:

        ball.append(i + 1)

print((*ball))

n = int(eval(input()))

nums = [int(i) for i in input().split()]

box = [0] * n

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

    c = i * 2

    ball = nums[i - 1]

    while c <= n:

        ball = ball ^ box[c - 1]

        c += i

    box[i - 1] = ball



ans = box.count(1)

print(ans)

ball = []

for i in range(n):

    if box[i] == 1:

        ball.append(i + 1)

print((*ball))

n = int(eval(input()))
nums = [int(i) for i in input().split()]
box = [-1] * n
for i in range(1, n + 1)[::-1]:
    c = i * 2
    ball = nums[i - 1]
    while c <= n:
        ball = ball ^ box[c - 1]
        c += i
    box[i - 1] = ball
ans = box.count(1)
print(ans)
ball = []
for i in range(n):
    if box[i] == 1:
        ball.append(i + 1)
print((*ball))

n = int(eval(input()))
nums = [int(i) for i in input().split()]
box = [0] * n
for i in range(1, n + 1)[::-1]:
    c = i * 2
    ball = nums[i - 1]
    while c <= n:
        ball = ball ^ box[c - 1]
        c += i
    box[i - 1] = ball
ans = box.count(1)
print(ans)
ball = []
for i in range(n):
    if box[i] == 1:
        ball.append(i + 1)
print((*ball))

-box = [-1] * n +box = [0] * n