#include using namespace std; using ll = long long; const int MAX_BITS = 60; vector basis(MAX_BITS, 0); // Linear basis array of size 60 vector basis_idx(MAX_BITS); // To store one index corresponding to each basis vector // Function to insert number into the basis bool insertBasis(ll x, int idx) { vector result; for (int i = MAX_BITS - 1; i >= 0; --i) { if (!(x & (1LL << i))) continue; // Skip if bit is not set if (!basis[i]) { // If this bit is not yet in the basis basis[i] = x; basis_idx[i] = idx; // Store the index of this element return true; // Inserted successfully } // Reduce x by the basis element x ^= basis[i]; result.push_back(basis_idx[i]); } // If x becomes 0, it means this element is a combination of basis elements result.push_back(idx); // Output the result indices printf("%d\n", (int)result.size()); for (int i : result) { printf("%d ", i + 1); // Output 1-based index } printf("\n"); return false; // This element was not added to the basis } int main() { int n; scanf("%d", &n); vector a(n); // Input the array for (int i = 0; i < n; ++i) { scanf("%lld", &a[i]); } // Insert each element into the basis for (int i = 0; i < n; ++i) { if (a[i] == 0) { // Handle edge case where element is already zero printf("1\n%d\n", i + 1); return 0; } if (!insertBasis(a[i], i)) { return 0; // Found a subset that XORs to zero, so stop } } // If no zero XOR subset was found, output -1 puts("-1"); return 0; }