#include using namespace std; using ll = long long; const int INF = 1e9 + 10; const ll INFL = 4e18; /* F_2 上の連立線形方程式 ref: https://qiita.com/drken/items/a14e9af0ca2d857b85c3 */ // 掃き出し法 // vector> a: 連立方程式 Ax=b の拡大係数行列 // return: a のランク template struct BitMatrix { int row, col; array, Row> val; BitMatrix() { row = Row; col = Col; for (int i = 0; i < row; i++) val[i].reset(); } }; template int rowReduction(BitMatrix& a, vector& where) { int rank = 0; for (int c = 0; c < col - 1; c++) { int pivot = rank; while (pivot < row && !a.val[pivot][c]) pivot++; if (pivot == row) continue; swap(a.val[pivot], a.val[rank]); where.push_back(c); for (int r = 0; r < row; r++) { if (r != rank && a.val[r][c]) { for (int i = 0; i < c; i++) a.val[r][i] = a.val[r][i] ^ a.val[rank][i]; } } rank++; if (rank == row) break; } return rank; } // 連立線形方程式 Ax=b を解く // x0: 特殊解(b=0 の場合は自明解になる) // ker: Ax=0 の解空間の基底 // 一般解は x0 と解空間の基底の任意の線形結合で表される template bool linearEquation(BitMatrix a, BitMatrix b, BitMatrix& x0, vector>& ker) { BitMatrix a2; for (int r = 0; r < row; r++) { for (int c = 0; c < col; c++) a2.val[r][c] = a.val[r][c]; a2.val[r][col] = b.val[r][0]; } vector where; int rank = rowReduction(a2, where); for (int r = rank; r < row; r++) { if (a2.val[r][col]) return false; } if (!where.empty() && where.back() == col) return false; for (int i = 0; i < rank; i++) x0.val[where[i]][0] = a2.val[i][col]; // Ax=0 の解空間の基底 int r = 0; for (int c = 0; c < col; c++) { if (r < rank && c == where[r]) { r++; continue; } /*vectorx(col); x[c]=true; for(int r2=0;r2 x; x[c] = 1; for (int r2 = 0; r2 < r; r2++) x[where[r2]] = a2.val[r2][c]; ker.push_back(x); } /*{ //いわゆる noshi 基底 vectora3(row); for(int r=0;rbasis; for(ll e:a3){ for(ll b:basis)e=min(e,e^b); if(e)basis.push_back(e); } ker=vector>(basis.size(),vector(col,false)); for(int r=0;r<(int)basis.size();r++){ for(int c=0;c>c&1; } }*/ return rank; } int main() { int N; cin >> N; vector A(N); for (int i = 0; i < N; i++) cin >> A[i]; for (int i = 0; i < N; i++) { if (A[i] == 0) { cout << 1 << endl; cout << i + 1 << endl; return 0; } } BitMatrix<60, 200000> a; for (int i = 0; i < N; i++) { for (int j = 0; j < 60; j++) a.val[j][i] = (A[i] >> j) & 1; } /*vector x0; vector> xs;*/ BitMatrix<200000, 1> x0; vector> xs; BitMatrix<60, 1> b; for (int i = 0; i < N; i++) b.val[i][0] = 0; bool res = linearEquation<60, 200000>(a, b, x0, xs); if (!res || xs.size() == 0) return cout << -1 << endl, 0; vector ans; for (int i = 0; i < N; i++) { if (xs[0][i]) ans.push_back(i + 1); } if (ans.size() == 0) return cout << -1 << endl, 0; cout << ans.size() << endl; for (int x : ans) cout << x << ' '; cout << endl; }