#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long double E = 1e-8;
mt19937_64 rnd(time(0));
long long p1 = 31, p2 = 37, p3 = 7, p4 = rnd() % 100 + 1, md1 = MOD,
          md2 = 998244353, md3 = 998244357, md4 = rnd() % 1000000000;
int n, m, k, h, T, kol = 0, sz = 0, a[401], dp[401][401][401];
long long binpow(long long h, long long r, long long md = MOD) {
  long long l = 1;
  while (r) {
    if (r & 1) l *= h, l %= md;
    h *= h;
    h %= md;
    r /= 2;
  }
  return l;
}
long long gcd(long long x, long long y) {
  if (x < y) swap(x, y);
  while (x && y) {
    x %= y;
    swap(x, y);
  }
  return x + y;
}
long long basis[31];
void insert_into_basis(int h) {
  for (int i = 0; i < 30; i++)
    if (h & (1 << i)) {
      if (basis[i] == 0) {
        basis[i] = h;
        sz++;
        return;
      }
      h ^= basis[i];
    }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  long long o = 0;
  vector<long long> v;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    o ^= x;
    v.push_back(x);
  }
  if (o == 0) {
    cout << "-1\n";
    return 0;
  }
  reverse(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) insert_into_basis(v[i]);
  cout << sz << "\n";
  return 0;
}

### Prompt

Please provide a cpp coded solution to the problem described below:

You are given an array a_1, a_2, ..., a_n of integer numbers.

Your task is to divide the array into the maximum number of segments in such a way that:

  * each element is contained in exactly one segment; 
  * each segment contains at least one element; 
  * there doesn't exist a non-empty subset of segments such that bitwise XOR of the numbers from them is equal to 0. 



Print the maximum number of segments the array can be divided into. Print -1 if no suitable division exists.

Input

The first line contains a single integer n (1 ≤ n ≤ 2 ⋅ 10^5) — the size of the array.

The second line contains n integers a_1, a_2, ..., a_n (0 ≤ a_i ≤ 10^9).

Output

Print the maximum number of segments the array can be divided into while following the given constraints. Print -1 if no suitable division exists.

Examples

Input


4
5 5 7 2


Output


2


Input


3
1 2 3


Output


-1


Input


3
3 1 10


Output


3

Note

In the first example 2 is the maximum number. If you divide the array into \{[5], [5, 7, 2]\}, the XOR value of the subset of only the second segment is 5 ⊕ 7 ⊕ 2 = 0. \{[5, 5], [7, 2]\} has the value of the subset of only the first segment being 5 ⊕ 5 = 0. However, \{[5, 5, 7], [2]\} will lead to subsets \{[5, 5, 7]\} of XOR 7, \{[2]\} of XOR 2 and \{[5, 5, 7], [2]\} of XOR 5 ⊕ 5 ⊕ 7 ⊕ 2 = 5.

Let's take a look at some division on 3 segments — \{[5], [5, 7], [2]\}. It will produce subsets:

  * \{[5]\}, XOR 5; 
  * \{[5, 7]\}, XOR 2; 
  * \{[5], [5, 7]\}, XOR 7; 
  * \{[2]\}, XOR 2; 
  * \{[5], [2]\}, XOR 7; 
  * \{[5, 7], [2]\}, XOR 0; 
  * \{[5], [5, 7], [2]\}, XOR 5; 



As you can see, subset \{[5, 7], [2]\} has its XOR equal to 0, which is unacceptable. You can check that for other divisions of size 3 or 4, non-empty subset with 0 XOR always exists.

The second example has no suitable divisions.

The third example array can be divided into \{[3], [1], [10]\}. No subset of these segments has its XOR equal to 0.

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long double E = 1e-8;
mt19937_64 rnd(time(0));
long long p1 = 31, p2 = 37, p3 = 7, p4 = rnd() % 100 + 1, md1 = MOD,
          md2 = 998244353, md3 = 998244357, md4 = rnd() % 1000000000;
int n, m, k, h, T, kol = 0, sz = 0, a[401], dp[401][401][401];
long long binpow(long long h, long long r, long long md = MOD) {
  long long l = 1;
  while (r) {
    if (r & 1) l *= h, l %= md;
    h *= h;
    h %= md;
    r /= 2;
  }
  return l;
}
long long gcd(long long x, long long y) {
  if (x < y) swap(x, y);
  while (x && y) {
    x %= y;
    swap(x, y);
  }
  return x + y;
}
long long basis[31];
void insert_into_basis(int h) {
  for (int i = 0; i < 30; i++)
    if (h & (1 << i)) {
      if (basis[i] == 0) {
        basis[i] = h;
        sz++;
        return;
      }
      h ^= basis[i];
    }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  long long o = 0;
  vector<long long> v;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    o ^= x;
    v.push_back(x);
  }
  if (o == 0) {
    cout << "-1\n";
    return 0;
  }
  reverse(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) insert_into_basis(v[i]);
  cout << sz << "\n";
  return 0;
}

```