#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include //#define int ll #define INT128_MAX (__int128)(((unsigned __int128) 1 << ((sizeof(__int128) * __CHAR_BIT__) - 1)) - 1) #define INT128_MIN (-INT128_MAX - 1) #define pb push_back #define eb emplace_back #define clock chrono::steady_clock::now().time_since_epoch().count() using namespace std; template ostream& print_tuple(ostream& os, const tuple tu) { os << get(tu); if constexpr (I + 1 != sizeof...(args)) { os << ' '; print_tuple(os, tu); } return os; } template ostream& operator<<(ostream& os, const tuple tu) { return print_tuple(os, tu); } template ostream& operator<<(ostream& os, const pair pr) { return os << pr.first << ' ' << pr.second; } template ostream& operator<<(ostream& os, const array &arr) { for(size_t i = 0; T x : arr) { os << x; if (++i != N) os << ' '; } return os; } template ostream& operator<<(ostream& os, const vector &vec) { for(size_t i = 0; T x : vec) { os << x; if (++i != size(vec)) os << ' '; } return os; } template ostream& operator<<(ostream& os, const set &s) { for(size_t i = 0; T x : s) { os << x; if (++i != size(s)) os << ' '; } return os; } template ostream& operator<<(ostream& os, const multiset &s) { for(size_t i = 0; T x : s) { os << x; if (++i != size(s)) os << ' '; } return os; } template ostream& operator<<(ostream& os, const map &m) { for(size_t i = 0; pair x : m) { os << x.first << " : " << x.second; if (++i != size(m)) os << ", "; } return os; } #ifdef DEBUG #define dbg(...) cerr << '(', _do(#__VA_ARGS__), cerr << ") = ", _do2(__VA_ARGS__) template void _do(T &&x) { cerr << x; } template void _do(T &&x, S&&...y) { cerr << x << ", "; _do(y...); } template void _do2(T &&x) { cerr << x << endl; } template void _do2(T &&x, S&&...y) { cerr << x << ", "; _do2(y...); } #else #define dbg(...) #endif using ll = long long; using ull = unsigned long long; using ldb = long double; using pii = pair; using pll = pair; //#define double ldb template using vc = vector; template using vvc = vc>; template using vvvc = vc>; using vi = vc; using vll = vc; using vvi = vvc; using vvll = vvc; template using min_heap = priority_queue, greater>; template using max_heap = priority_queue; template concept R_invocable = requires(F&& f, Args&&... args) { { std::invoke(std::forward(f), std::forward(args)...) } -> std::same_as; }; template, typename F> requires R_invocable void pSum(rng &&v, F f) { if (!v.empty()) for(T p = *v.begin(); T &x : v | views::drop(1)) x = p = f(p, x); } template> void pSum(rng &&v) { if (!v.empty()) for(T p = *v.begin(); T &x : v | views::drop(1)) x = p = p + x; } template void Unique(rng &v) { ranges::sort(v); v.resize(unique(v.begin(), v.end()) - v.begin()); } template rng invPerm(rng p) { rng ret = p; for(int i = 0; i < ssize(p); i++) ret[p[i]] = i; return ret; } template vi argSort(rng p) { vi id(size(p)); iota(id.begin(), id.end(), 0); ranges::sort(id, {}, [&](int i) { return pair(p[i], i); }); return id; } template, typename F> requires invocable vi argSort(rng p, F proj) { vi id(size(p)); iota(id.begin(), id.end(), 0); ranges::sort(id, {}, [&](int i) { return pair(proj(p[i]), i); }); return id; } template vvi read_graph(int n, int m, int base) { vvi g(n); for(int i = 0; i < m; i++) { int u, v; cin >> u >> v; u -= base, v -= base; g[u].emplace_back(v); if constexpr (!directed) g[v].emplace_back(u); } return g; } template vvi adjacency_list(int n, vc e, int base) { vvi g(n); for(auto [u, v] : e) { u -= base, v -= base; g[u].emplace_back(v); if constexpr (!directed) g[v].emplace_back(u); } return g; } template void setBit(T &msk, int bit, bool x) { (msk &= ~(T(1) << bit)) |= T(x) << bit; } template void onBit(T &msk, int bit) { setBit(msk, bit, true); } template void offBit(T &msk, int bit) { setBit(msk, bit, false); } template void flipBit(T &msk, int bit) { msk ^= T(1) << bit; } template bool getBit(T msk, int bit) { return msk >> bit & T(1); } template T floorDiv(T a, T b) { if (b < 0) a *= -1, b *= -1; return a >= 0 ? a / b : (a - b + 1) / b; } template T ceilDiv(T a, T b) { if (b < 0) a *= -1, b *= -1; return a >= 0 ? (a + b - 1) / b : a / b; } template bool chmin(T &a, T b) { return a > b ? a = b, 1 : 0; } template bool chmax(T &a, T b) { return a < b ? a = b, 1 : 0; } template struct xor_basis { int nxt = 0; bitset *B[W] = {}, *ids[W] = {}; pair> insert(bitset x) { bitset v = {}; for(int i = 0; i < W; i++) { if (x[i]) { if (!B[i]) { v[nxt++] = true; B[i] = new bitset(x); ids[i] = new bitset(v); return pair(true, bitset(0)); } x ^= *B[i], v ^= *ids[i]; } } return pair(false, v); } pair> query(bitset x) { bitset v = {}; for(int i = 0; i < W; i++) if (B[i] and x[i]) x ^= *B[i], v ^= *ids[i]; return pair(x.none(), x.none() ? v : bitset(0)); } }; /* struct xor_basis { static constexpr int W = 64; using i64 = int64_t; int nxt = 0; i64 B[W] = {}, ids[W] = {}; pair insert(i64 x) { i64 v = 0; for(int i = 0; i < W; i++) { if (x >> i & 1) { if (!B[i]) { B[i] = x, ids[i] = v | (1ll << (nxt++)); return pair(true, 0); } x ^= B[i], v ^= ids[i]; } } return pair(false, v); } pair query(i64 x) { i64 v = 0; for(int i = 0; i < W; i++) if (B[i] and (x >> i & 1)) x ^= B[i], v ^= ids[i]; return pair(x == 0, x == 0 ? v : 0); } }; */ signed main() { ios::sync_with_stdio(false), cin.tie(NULL); int n; cin >> n; vll a(n); for(ll &x : a) cin >> x; vi id; xor_basis<60> B; for(int j = -1; ll x : a) { j++; auto [ok, sol] = B.insert(x); if (ok) id.eb(x); else { vi tmp; for(int i = 0; i < 60; i++) if (sol[i]) tmp.eb(i + 1); tmp.eb(j + 1); cout << ssize(tmp) << '\n'; cout << tmp << '\n'; return 0; } } cout << -1 << '\n'; return 0; }