// https://github.com/south37/atcoder/blob/master/template.cpp // http://drken1215.hatenablog.com/entry/2019/03/20/174600 #include #include #include #include #include #include #include #include #include #include using namespace std; #define rep(i, n) for(int i = 0; i < n; ++i) #define all(s) s.begin(), s.end() int dx[] = { 1, -1, 0, 0 }; int dy[] = { 0, 0, 1, -1 }; typedef long long ll; typedef unsigned long long ull; typedef pair P; typedef tuple triple; typedef double D; int gcd(int a, int b) { if (a < b) { swap(a, b); } if (b == 0) { return a; } return gcd(b, a % b); } bool prime(int n) { for (int i = 2; i <= sqrt(n); ++i) { if (n % i == 0) { return false; } } return n != 1; } template inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; } const ll INF = 1e9; const ll MOD = 1000000007; // 1e9 + 7 ll powmod(ll x, ll y) { ll r = 1; while (y) { if (y & 1) { r = r * x % MOD; } x = x * x % MOD; y >>= 1; } return r; } const int COM_MAX = 500010; ll fac[COM_MAX], facinv[COM_MAX], inv[COM_MAX]; void COMinit() { fac[0] = fac[1] = 1; facinv[0] = facinv[1] = 1; inv[1] = 1; for(int i = 2; i < COM_MAX; ++i) { fac[i] = fac[i-1] * i % MOD; inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD; facinv[i] = facinv[i-1] * inv[i] % MOD; } } ll COM(ll n, ll k) { return (fac[n] * facinv[k] % MOD) * facinv[n-k] % MOD; } ll PERM(ll n, ll k) { return (fac[n] * facinv[k] % MOD); } const int MAX_ROW = 100; // To be set appropriately. const int MAX_COL = 100010; // To be set appropriately. class BitMatrix { public: BitMatrix(int m = 1, int n = 1) : H(m), W(n) {} inline bitset& operator [] (int i) { return val[i]; } int H, W; private: bitset val[MAX_ROW]; }; ostream& operator << (ostream& s, BitMatrix A) { s << endl; rep(i, A.H) { rep(j, A.W) { s << A[i][j] << ", "; } s << endl; } return s; } int GaussJordan(BitMatrix &A, bool is_extended = false) { int rank = 0; rep(col, A.W) { if (is_extended && col == A.W - 1) { break; } int pivot = -1; for (int row = rank; row < A.H; ++row) { if (A[row][col]) { pivot = row; break; } } if (pivot == -1) continue; swap(A[pivot], A[rank]); rep(row, A.H) { if (row != rank && A[row][col]) { A[row] ^= A[rank]; } } ++rank; } return rank; } int linear_equation(BitMatrix A, vector b, vector &res) { int m = A.H, n = A.W; BitMatrix M(m, n + 1); rep(i, m) { rep(j, n) { M[i][j] = A[i][j]; } M[i][n] = b[i]; } int rank = GaussJordan(M, true); // check if it has no solution for (int row = rank; row < m; ++row) { if (M[row][n]) { return -1; } } // answer res.assign(n, 0); rep(i, rank) { res[i] = M[i][n]; } return rank; } int main(int argc, char** argv) { int N; cin >> N; vector a(N); rep(i, N) { cin >> a[i]; } const int DIGIT = 61; BitMatrix A(DIGIT, N); rep(d, DIGIT) { rep(i, N) { if (a[i] & (1LL << d)) { A[d][i] = 1; } } } int rank = GaussJordan(A); cout << (1LL << rank) << endl; }