# 2019-11-15 14:12:24(JST)

import sys

# import collections

# import math

# from string import ascii_lowercase, ascii_uppercase, digits

# from bisect import bisect_left as bi_l, bisect_right as bi_r

# import itertools

# from functools import reduce

# import operator as op

# import re

# from scipy.misc import comb # float

# import numpy as np 



def main():

    n, *a = [int(x) for x in sys.stdin.read().split()]

    a = [None] + a



    in_or_not = [0 for _ in range(n+1)]

    for i in range(n, 0, -1):

        count = sum(in_or_not[2*i:n+1:i])  

        in_or_not[i] = a[i] ^ count % 2

    

    print(in_or_not.count(1))

    for i in range(1, n+1):

        if in_or_not[i] == 1:

            print(i, end=' ')





if __name__ == "__main__":

    main()

import sys



n, *a = map(int, sys.stdin.read().split())

a = [None] + a



def main():

    res = [0] * (n + 1)

    chosen = []

    for i in range(n, 0, -1):

        tmp = sum(res[i*2:n+1:i]) & 1

        if tmp ^ a[i]:

            res[i] = 1

            chosen.append(i)



    if chosen:

        m = len(chosen)

        return [m], chosen[::-1]

    else:

        return [[0]]



if __name__ == '__main__':

    ans = main()

    for a in ans:

        print(*a, sep=' ')

# 2019-11-15 14:12:24(JST)
import sys

# import collections
# import math
# from string import ascii_lowercase, ascii_uppercase, digits
# from bisect import bisect_left as bi_l, bisect_right as bi_r
# import itertools
# from functools import reduce
# import operator as op
# import re
# from scipy.misc import comb # float
# import numpy as np
def main():
    n, *a = [int(x) for x in sys.stdin.read().split()]
    a = [None] + a
    in_or_not = [0 for _ in range(n + 1)]
    for i in range(n, 0, -1):
        count = sum(in_or_not[2 * i : n + 1 : i])
        in_or_not[i] = a[i] ^ count % 2
    print(in_or_not.count(1))
    for i in range(1, n + 1):
        if in_or_not[i] == 1:
            print(i, end=" ")


if __name__ == "__main__":
    main()

import sys

n, *a = map(int, sys.stdin.read().split())
a = [None] + a


def main():
    res = [0] * (n + 1)
    chosen = []
    for i in range(n, 0, -1):
        tmp = sum(res[i * 2 : n + 1 : i]) & 1
        if tmp ^ a[i]:
            res[i] = 1
            chosen.append(i)
    if chosen:
        m = len(chosen)
        return [m], chosen[::-1]
    else:
        return [[0]]


if __name__ == "__main__":
    ans = main()
    for a in ans:
        print(*a, sep=" ")

-# 2019-11-15 14:12:24(JST) -# import collections -# import math -# from string import ascii_lowercase, ascii_uppercase, digits -# from bisect import bisect_left as bi_l, bisect_right as bi_r -# import itertools -# from functools import reduce -# import operator as op -# import re -# from scipy.misc import comb # float -# import numpy as np +n, *a = map(int, sys.stdin.read().split()) +a = [None] + a + + -    n, *a = [int(x) for x in sys.stdin.read().split()] -    a = [None] + a -    in_or_not = [0 for _ in range(n + 1)] +    res = [0] * (n + 1) +    chosen = [] -        count = sum(in_or_not[2 * i : n + 1 : i]) -        in_or_not[i] = a[i] ^ count % 2 -    print(in_or_not.count(1)) -    for i in range(1, n + 1): -        if in_or_not[i] == 1: -            print(i, end=" ") +        tmp = sum(res[i * 2 : n + 1 : i]) & 1 +        if tmp ^ a[i]: +            res[i] = 1 +            chosen.append(i) +    if chosen: +        m = len(chosen) +        return [m], chosen[::-1] +    else: +        return [[0]] -    main() +    ans = main() +    for a in ans: +        print(*a, sep=" ")