#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 のランク int rowReduction(vector>& a, vector& where) { int row = a.size(), col = a.front().size(); int rank = 0; for (int c = 0; c < col - 1; c++) { int pivot = rank; while (pivot < row && !a[pivot][c]) pivot++; if (pivot == row) continue; swap(a[pivot], a[rank]); where.push_back(c); for (int r = 0; r < row; r++) { if (r != rank && a[r][c]) { // A[r]^=A[c] for (int i = 0; i < c; i++) a[r][i] = a[r][i] ^ a[rank][i]; } } rank++; if (rank == row) break; } return rank; } // 連立線形方程式 Ax=b を解く // x0: 特殊解(b=0 の場合は自明解になる) // ker: Ax=0 の解空間の基底 // 一般解は x0 と解空間の基底の任意の線形結合で表される bool linearEquation(vector> a, vector b, vector& x0, vector>& ker) { int row = a.size(), col = a.front().size(); vector> a2 = a; for (int i = 0; i < row; i++) a2[i].push_back(b[i]); vector where; int rank = rowReduction(a2, where); for (int r = rank; r < row; r++) { if (a2[r][col]) return false; } if (!where.empty() && where.back() == col) return false; x0 = vector(col, false); for (int i = 0; i < rank; i++) x0[where[i]] = a2[i][col]; // Ax=0 の解空間の基底 int r = 0; for (int c = 0; c < col; c++) { if (r < rank && c == where[r]) { r++; continue; } vector x(col); x[c] = true; for (int r2 = 0; r2 < r; r2++) x[where[r2]] = a2[r2][c]; ker.push_back(x); return true; } /*{ //いわゆる 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 true; // 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; } } const int L = 60; vector> a(L, vector(N)); for (int i = 0; i < N; i++) { for (int j = 0; j < L; j++) { a[j][i] = (A[i] >> j) & 1; } } vector x0; vector> xs; bool res = linearEquation(a, vector(N, false), 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; }