using System; using static System.Console; using System.Linq; using System.Collections.Generic; class Program { static int NN => int.Parse(ReadLine()); static long[] NList => ReadLine().Split().Select(long.Parse).ToArray(); public static void Main() { Solve(); } static void Solve() { var n = NN; var a = NList; for (var i = 0; i < n; ++i) if (a[i] == 0) { WriteLine(1); WriteLine(i + 1); return; } var bitmax = 60; if (a.Length > bitmax + 1) a = a.Take(bitmax + 1).ToArray(); var map = new int[bitmax][]; for (var i = 0; i < bitmax; ++i) { map[i] = new int[n + 1]; for (var j = 0; j < n; ++j) map[i][j] = (int)((a[j] >> i) & 1); } GaussJordanEliminationXor(map); var ans = Check(map); if (ans.Length == 0) WriteLine(-1); else { var a2 = new List(); for (var i = 0; i < ans.Length; ++i) if (ans[i] != 0) a2.Add(i + 1); WriteLine(a2.Count); WriteLine(string.Join(" ", a2)); } } // XOR(= mod2の足し算)で掃き出し法を行う static void GaussJordanEliminationXor(int[][] map) { // 標準系にする var px = -1; for (var j = 0; j < map[0].Length - 1; ++j) { var x = px + 1; if (x >= map.Length) break; var sw = -1; for (var i = x; i < map.Length; ++i) if (map[i][j] != 0) { sw = i; break; } if (sw < 0) continue; if (x != sw) (map[x], map[sw]) = (map[sw], map[x]); for (var i = 0; i < map.Length; ++i) if (i != x) { if (map[i][j] != 0) { for (var p = j; p < map[i].Length; ++p) map[i][p] = (map[i][p] + map[x][p]) & 1; } } px = x; } } // 掃き出し法の結果から解を求める static int[] Check(int[][] map) { var n = map[0].Length - 1; var iskey = new bool[n]; var isfree = new bool[n]; for (var i = 0; i < map.Length; ++i) { var flg = true; for (var j = 0; j < n; ++j) if (map[i][j] != 0) { if (flg) { iskey[j] = true; } else { isfree[j] = true; } flg = false; } // 解なしチェック if (flg && map[i][^1] != 0) return new int[0]; } var ans = new int[n]; // (この問題のみ) // freeがない場合解なし // freeのうち最初のみ1に設定し、あとは0に設定 if (isfree.All(f => !f)) return new int[0]; for (var i = 0; i < n; ++i) if (isfree[i]) { ans[i] = 1; break; } for (var i = 0; i < map.Length; ++i) { var pos = -1; for (var j = 0; j < n; ++j) if (map[i][j] != 0) { if (pos < 0) pos = j; else { ans[pos] = (ans[pos] + ans[j]) % 2; } } if (pos >= 0) ans[pos] = (ans[pos] + map[i][^1]) % 2; } return ans; } }