def make_divisors(n):

    divisors = []

    for i in range(1, int(n**0.5)+1):

        if n % i == 0:

            divisors.append(i)

            if i != n // i:

                divisors.append(n//i)

    return divisors

  

def solve():

  n = int(input())

  a = list(int(i) for i in input().split())

  ans = [0]*n

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

    if a[i] == 0:

      continue

    else:

      ans[i] = 1

      tmp = i+1

      div = make_divisors(tmp)

      ##print(div)

      for j in div:

        a[j-1] = 1^a[j-1]

        

  print(sum(ans))

  for i in range(len(ans)):

    if ans[i] == 1:

      print(i+1,end = " ")

solve()

##https://atcoder.jp/contests/abc134/submissions/6482430

import sys

input = sys.stdin.readline

def main():

    n = int(eval(input()))

    A = [0] + list(int(i) for i in input().split())

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

        A[i] = sum(A[i::i]) % 2

    ans = [i for i, j in enumerate(A) if j]

    print((len(ans)))

    print((*ans))

 

 

if __name__ == "__main__":

    main()
def make_divisors(n):
    divisors = []
    for i in range(1, int(n**0.5) + 1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n // i)
    return divisors


def solve():
    n = int(input())
    a = list(int(i) for i in input().split())
    ans = [0] * n
    for i in range(n - 1, -1, -1):
        if a[i] == 0:
            continue
        else:
            ans[i] = 1
            tmp = i + 1
            div = make_divisors(tmp)
            ##print(div)
            for j in div:
                a[j - 1] = 1 ^ a[j - 1]
    print(sum(ans))
    for i in range(len(ans)):
        if ans[i] == 1:
            print(i + 1, end=" ")


solve()

##https://atcoder.jp/contests/abc134/submissions/6482430
import sys

input = sys.stdin.readline


def main():
    n = int(eval(input()))
    A = [0] + list(int(i) for i in input().split())
    for i in range(n // 2, 0, -1):
        A[i] = sum(A[i::i]) % 2
    ans = [i for i, j in enumerate(A) if j]
    print((len(ans)))
    print((*ans))


if __name__ == "__main__":
    main()

-def make_divisors(n): -    divisors = [] -    for i in range(1, int(n**0.5) + 1): -        if n % i == 0: -            divisors.append(i) -            if i != n // i: -                divisors.append(n // i) -    return divisors +##https://atcoder.jp/contests/abc134/submissions/6482430 +import sys + +input = sys.stdin.readline -def solve(): -    n = int(input()) -    a = list(int(i) for i in input().split()) -    ans = [0] * n -    for i in range(n - 1, -1, -1): -        if a[i] == 0: -            continue -        else: -            ans[i] = 1 -            tmp = i + 1 -            div = make_divisors(tmp) -            ##print(div) -            for j in div: -                a[j - 1] = 1 ^ a[j - 1] -    print(sum(ans)) -    for i in range(len(ans)): -        if ans[i] == 1: -            print(i + 1, end=" ") +def main(): +    n = int(eval(input())) +    A = [0] + list(int(i) for i in input().split()) +    for i in range(n // 2, 0, -1): +        A[i] = sum(A[i::i]) % 2 +    ans = [i for i, j in enumerate(A) if j] +    print((len(ans))) +    print((*ans)) -solve() +if __name__ == "__main__": +    main()