using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections;

namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {
            var exStdIn = new System.IO.StreamReader("stdin.txt");
            System.Console.SetIn(exStdIn);

            string[] input = Console.ReadLine().Split(' ');
            int n = int.Parse(input[0]);
            input = Console.ReadLine().Split(' ');
            bool[] a = new bool[n];
            for (int i = 0; i < n; i++)
            {
                if (input[i] == "1") // 奇数はtrue
                {
                    a[i] = true;
                }else
                {
                    a[i] = false;
                }

            }

            bool[] box = new bool[n];
            for (int i = n; i > n / 2; i--)
            {
                //後ろ半分は自身のみで決まる
                box[i-1] = a[i-1];
            }
            for (int i = n / 2; i > 0; i--)
            {
                bool sum = false;
                for (int j = i * 2; j <= n; j = j + i)
                {
                    sum = sum ^ box[j - 1];
                }
                box[i-1] = sum ^ a[i-1];
            }

            int count = 0;
            StringBuilder ooo = new StringBuilder();
            for(int i = 0; i < n; i++)
            {
                if (box[i])
                {
                    count++;
                    if (ooo.ToString() == "")
                    {
                        ooo.Append((i + 1));
                    }
                    else
                    {
                        ooo.Append(" ");
                        ooo.Append((i + 1));
                    }
                }
            }
            Console.WriteLine(count.ToString());
            if (count != 0)
            {
                Console.WriteLine(ooo.ToString());
            }
            
        }
    }
}