{-# LANGUAGE BangPatterns #-}
import Control.Monad
import Data.Maybe
import Debug.Trace
import Data.List
import qualified Data.Map.Strict as Map
import qualified Data.IntMap.Strict as IntMap
import qualified Data.Set as Set
import qualified Data.IntSet as IntSet
import Data.Functor
-- import Data.Array
import Data.Array.Unboxed
import Control.Monad.ST
import Data.Array.ST

main :: IO ()
main = do
  n <- readLn :: IO Int
  as <- map read . words <$> getLine :: IO [Int]
  solve' n as

solve' :: Int -> [Int] -> IO ()
solve' n as = go (IntMap.empty) . reverse $ zip as [1..n]
  where
    arr = listArray (1, n) as :: Array Int Int
    go :: IntMap.IntMap Int -> [(Int, Int)] -> IO ()
    go mp [] = do
      let m = sum . IntMap.elems $ mp
      print m
      if m == 0 
        then return ()
        else putStrLn . unwords . map show $ replicate m 1
    go mp ((a, i):as) = go newmp as
      where
        newmp = IntMap.insert i ((((sum $ catMaybes [ IntMap.lookup (i * j) mp | j <- [2..(n `div` i)]]) `mod` 2) + arr!i) `mod` 2) mp
