import Data.Array

main = do
  li <- getLine
  let n = read li
  li <- getLine
  let as = map read $ words li
  let ans = compute n as
  sequence_ $ map print ans

compute :: Int -> [Int] -> [Int]
compute n as = [i | (i,1) <- assocs ca]
  where
    aa = listArray (1,n) as
    ca = listArray (1,n) (map c [1..n])
    c i = (aa ! i + x) `mod` 2
      where
        x = sum [ ca ! k | k <- [2*i,3*i..n] ]
