# -*- coding: utf-8 -*-



import sys

from math import sqrt



def input(): return sys.stdin.readline().strip()

def list2d(a, b, c): return [[c] * b for i in range(a)]

def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]

def ceil(x, y=1): return int(-(-x // y))

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(): return list(map(int, input().split()))

def Yes(): print('Yes')

def No(): print('No')

def YES(): print('YES')

def NO(): print('NO')

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

MOD = 10 ** 9 + 7



def divisor_set(N: int) -> set:

    """ 約数の列挙・個数 """

    # 1とその数はデフォで入れとく

    s = {1, N}

    # 終点はルート切り捨て

    for i in range(2, int(sqrt(N))+1):

        # 割り切れるなら、iとN/iを追加

        if N % i == 0:

            s.add(i)

            s.add(N // i)

    return s



N=INT()

A=LIST()



A2=[0]*N

B=[]

for i in range(N-1, -1, -1):

    if A[i]!=A2[i]:

        B.append(i+1)

        div=divisor_set(i+1)

        for num in div:

            A2[num-1]=1-A2[num-1]

        

print((len(B)))

print((*B))

# -*- coding: utf-8 -*-



import sys



def input(): return sys.stdin.readline().strip()

def list2d(a, b, c): return [[c] * b for i in range(a)]

def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]

def ceil(x, y=1): return int(-(-x // y))

def INT(): return int(eval(input()))

def MAP(): return list(map(int, input().split()))

def LIST(): return list(map(int, input().split()))

def Yes(): print('Yes')

def No(): print('No')

def YES(): print('YES')

def NO(): print('NO')

sys.setrecursionlimit(10 ** 9)

INF = float('inf')

MOD = 10 ** 9 + 7



N=INT()

A=LIST()



# その位置にボールを入れるかを保持するA2

A2=[0]*N

B=[]

# 後ろから決めていく

for i in range(N-1, -1, -1):

    cur=i+1

    cnt=0

    # curの倍数を全部見に行く

    for j in range(cur*2, N+1, cur):

        cnt^=A2[j-1]

    # ボールを入れるべきかどうか

    if A[i]!=cnt:

        B.append(cur)

        A2[i]=1



print((len(B)))

print((*B))

# -*- coding: utf-8 -*-
import sys
from math import sqrt


def input():
    return sys.stdin.readline().strip()


def list2d(a, b, c):
    return [[c] * b for i in range(a)]


def list3d(a, b, c, d):
    return [[[d] * c for j in range(b)] for i in range(a)]


def ceil(x, y=1):
    return int(-(-x // y))


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST():
    return list(map(int, input().split()))


def Yes():
    print("Yes")


def No():
    print("No")


def YES():
    print("YES")


def NO():
    print("NO")


sys.setrecursionlimit(10**9)
INF = float("inf")
MOD = 10**9 + 7


def divisor_set(N: int) -> set:
    """約数の列挙・個数"""
    # 1とその数はデフォで入れとく
    s = {1, N}
    # 終点はルート切り捨て
    for i in range(2, int(sqrt(N)) + 1):
        # 割り切れるなら、iとN/iを追加
        if N % i == 0:
            s.add(i)
            s.add(N // i)
    return s


N = INT()
A = LIST()
A2 = [0] * N
B = []
for i in range(N - 1, -1, -1):
    if A[i] != A2[i]:
        B.append(i + 1)
        div = divisor_set(i + 1)
        for num in div:
            A2[num - 1] = 1 - A2[num - 1]
print((len(B)))
print((*B))

# -*- coding: utf-8 -*-
import sys


def input():
    return sys.stdin.readline().strip()


def list2d(a, b, c):
    return [[c] * b for i in range(a)]


def list3d(a, b, c, d):
    return [[[d] * c for j in range(b)] for i in range(a)]


def ceil(x, y=1):
    return int(-(-x // y))


def INT():
    return int(eval(input()))


def MAP():
    return list(map(int, input().split()))


def LIST():
    return list(map(int, input().split()))


def Yes():
    print("Yes")


def No():
    print("No")


def YES():
    print("YES")


def NO():
    print("NO")


sys.setrecursionlimit(10**9)
INF = float("inf")
MOD = 10**9 + 7
N = INT()
A = LIST()
# その位置にボールを入れるかを保持するA2
A2 = [0] * N
B = []
# 後ろから決めていく
for i in range(N - 1, -1, -1):
    cur = i + 1
    cnt = 0
    # curの倍数を全部見に行く
    for j in range(cur * 2, N + 1, cur):
        cnt ^= A2[j - 1]
    # ボールを入れるべきかどうか
    if A[i] != cnt:
        B.append(cur)
        A2[i] = 1
print((len(B)))
print((*B))

-from math import sqrt - - -def divisor_set(N: int) -> set: -    """約数の列挙・個数""" -    # 1とその数はデフォで入れとく -    s = {1, N} -    # 終点はルート切り捨て -    for i in range(2, int(sqrt(N)) + 1): -        # 割り切れるなら、iとN/iを追加 -        if N % i == 0: -            s.add(i) -            s.add(N // i) -    return s - - +# その位置にボールを入れるかを保持するA2 +# 後ろから決めていく -    if A[i] != A2[i]: -        B.append(i + 1) -        div = divisor_set(i + 1) -        for num in div: -            A2[num - 1] = 1 - A2[num - 1] +    cur = i + 1 +    cnt = 0 +    # curの倍数を全部見に行く +    for j in range(cur * 2, N + 1, cur): +        cnt ^= A2[j - 1] +    # ボールを入れるべきかどうか +    if A[i] != cnt: +        B.append(cur) +        A2[i] = 1