let n = Int(readLine()!)!

let a = readLine()!.split(separator: " ").map { Int($0)! }
var ans = true
for i in 0..<n {
  var j = i + 1
  var c = a[i]
  while j < n + 1 {
    if c != a[j - 1] {
      ans = false
      break
    }
    c = c ^ a[j-1]
    j += j
  }
  if !ans {
    break
  }
}

if ans {
  let m = a.filter { $0 == 1 }.count
  print(m)
  if m == 0 {
    print(0)
  } else {
  	a.enumerated().forEach { index, value in
    	if value == 1 {
      		print(index + 1)
    	}
  	}
  }
} else {
  print(-1)
}