import sys



read = sys.stdin.buffer.read

input = sys.stdin.buffer.readline

inputs = sys.stdin.buffer.readlines





# rstrip().decode('utf-8')

# INF=float("inf")

#MOD=10**9+7

# sys.setrecursionlimit(2147483647)

# import math

#import numpy as np

# import operator

# import bisect

# from heapq import heapify,heappop,heappush

#from math import gcd

# from fractions import gcd

# from collections import deque

# from collections import defaultdict

# from collections import Counter

# from itertools import accumulate

# from itertools import groupby

# from itertools import permutations

# from itertools import combinations

# from scipy.sparse import csr_matrix

# from scipy.sparse.csgraph import floyd_warshall

# from scipy.sparse.csgraph import csgraph_from_dense

# from scipy.sparse.csgraph import dijkstra

# map(int,input().split())





def main():

	n=int(eval(input()))

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

	ans=[0]*(n+1)

	

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

		ans[i]=(sum(ans[::i])%2) ^ A[i-1]

	

	print((sum(ans)))

	print((*[i for i,x in enumerate(ans) if x==1]))

	

	

if __name__ == '__main__':

	main()

import sys

input = sys.stdin.buffer.readline



#sys.setrecursionlimit(10**9)

#from functools import lru_cache



def RD(): return input().rstrip().decode()

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

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

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

def MF(): return list(map(float,input().split()))

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

def LF(): return list(map(float,input().split()))

def TI(): return tuple(map(int,input().split()))

# rstrip().decode()



def main():

	n=II()

	A=[0]+LI()

	B=[0]*(n+1)



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

		a=A[i]

		if n//i>=2:

			for j in range(2,n//i+1):

				#print(i,j)

				a^=B[i*j]

		B[i]=a



	ans=[]

	for i,v in enumerate(B):

		if v:

			ans.append(i)



	print((len(ans)))

	print((*ans))



























if __name__ == "__main__":

	main()

import sys

read = sys.stdin.buffer.read
input = sys.stdin.buffer.readline
inputs = sys.stdin.buffer.readlines
# rstrip().decode('utf-8')
# INF=float("inf")
# MOD=10**9+7
# sys.setrecursionlimit(2147483647)
# import math
# import numpy as np
# import operator
# import bisect
# from heapq import heapify,heappop,heappush
# from math import gcd
# from fractions import gcd
# from collections import deque
# from collections import defaultdict
# from collections import Counter
# from itertools import accumulate
# from itertools import groupby
# from itertools import permutations
# from itertools import combinations
# from scipy.sparse import csr_matrix
# from scipy.sparse.csgraph import floyd_warshall
# from scipy.sparse.csgraph import csgraph_from_dense
# from scipy.sparse.csgraph import dijkstra
# map(int,input().split())
def main():
    n = int(eval(input()))
    A = list(map(int, input().split()))
    ans = [0] * (n + 1)
    for i in range(n, 0, -1):
        ans[i] = (sum(ans[::i]) % 2) ^ A[i - 1]
    print((sum(ans)))
    print((*[i for i, x in enumerate(ans) if x == 1]))


if __name__ == "__main__":
    main()

import sys

input = sys.stdin.buffer.readline
# sys.setrecursionlimit(10**9)
# from functools import lru_cache
def RD():
    return input().rstrip().decode()


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


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


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


def MF():
    return list(map(float, input().split()))


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


def LF():
    return list(map(float, input().split()))


def TI():
    return tuple(map(int, input().split()))


# rstrip().decode()
def main():
    n = II()
    A = [0] + LI()
    B = [0] * (n + 1)
    for i in range(n, 0, -1):
        a = A[i]
        if n // i >= 2:
            for j in range(2, n // i + 1):
                # print(i,j)
                a ^= B[i * j]
        B[i] = a
    ans = []
    for i, v in enumerate(B):
        if v:
            ans.append(i)
    print((len(ans)))
    print((*ans))


if __name__ == "__main__":
    main()

-read = sys.stdin.buffer.read -inputs = sys.stdin.buffer.readlines -# rstrip().decode('utf-8') -# INF=float("inf") -# MOD=10**9+7 -# sys.setrecursionlimit(2147483647) -# import math -# import numpy as np -# import operator -# import bisect -# from heapq import heapify,heappop,heappush -# from math import gcd -# from fractions import gcd -# from collections import deque -# from collections import defaultdict -# from collections import Counter -# from itertools import accumulate -# from itertools import groupby -# from itertools import permutations -# from itertools import combinations -# from scipy.sparse import csr_matrix -# from scipy.sparse.csgraph import floyd_warshall -# from scipy.sparse.csgraph import csgraph_from_dense -# from scipy.sparse.csgraph import dijkstra -# map(int,input().split()) +# sys.setrecursionlimit(10**9) +# from functools import lru_cache +def RD(): +    return input().rstrip().decode() + + +def II(): +    return int(eval(input())) + + +def FI(): +    return int(eval(input())) + + +def MI(): +    return list(map(int, input().split())) + + +def MF(): +    return list(map(float, input().split())) + + +def LI(): +    return list(map(int, input().split())) + + +def LF(): +    return list(map(float, input().split())) + + +def TI(): +    return tuple(map(int, input().split())) + + +# rstrip().decode() -    n = int(eval(input())) -    A = list(map(int, input().split())) -    ans = [0] * (n + 1) +    n = II() +    A = [0] + LI() +    B = [0] * (n + 1) -        ans[i] = (sum(ans[::i]) % 2) ^ A[i - 1] -    print((sum(ans))) -    print((*[i for i, x in enumerate(ans) if x == 1])) +        a = A[i] +        if n // i >= 2: +            for j in range(2, n // i + 1): +                # print(i,j) +                a ^= B[i * j] +        B[i] = a +    ans = [] +    for i, v in enumerate(B): +        if v: +            ans.append(i) +    print((len(ans))) +    print((*ans))