#include <bits/stdc++.h>
using namespace std;
const long long MAX = 2e5 + 15;
vector<long long> ver[MAX];
vector<long long> g[MAX];
long long col[MAX];
long long co = 0;
long long ans = 0;
vector<long long> primes;
bool vip[MAX];
long long vis[MAX];
long long cup = 0;
long long dp[MAX];
void pre() {
  long long i, j;
  for (i = 2; i < MAX; i++) {
    if (vip[i]) continue;
    primes.push_back(i);
    for (j = i; j < MAX; j += i) vip[j] = true;
  }
}
void dfs(long long x) {
  long long m1 = 0, m2 = 0;
  vis[x] = co;
  dp[x] = 1;
  for (auto z : g[x]) {
    if (vis[z] == co) continue;
    if ((col[z] % cup) != 0) continue;
    dfs(z);
    dp[x] = max(dp[x], dp[z] + 1);
    if (dp[z] >= m1)
      m2 = m1, m1 = dp[z];
    else if (dp[z] >= m2)
      m2 = dp[z];
  }
  ans = max(ans, m1 + m2 + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(25);
  long long n;
  cin >> n;
  vector<long long> arr(n);
  long long x = 0;
  long long mx = 0;
  for (long long i = 0; i < n; i++)
    cin >> arr[i], x ^= arr[i], mx = max(mx, arr[i]);
  if (x == 0) {
    cout << -1 << endl;
    return 0;
  }
  long long ans = 0;
  vector<long long> v1;
  while ((!arr.empty()) && (mx != 0)) {
    ans++;
    long long a = mx;
    mx = 0;
    vector<long long> m1;
    for (long long i = 0; i < 32; i++)
      if (a & (1ll << i)) x = (1ll << i);
    for (auto i : arr) {
      if (!(i & x))
        m1.push_back(i);
      else
        m1.push_back(i ^ a);
      mx = max(mx, m1.back());
    }
    arr = m1;
  }
  cout << ans << endl;
}

### 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 MAX = 2e5 + 15;
vector<long long> ver[MAX];
vector<long long> g[MAX];
long long col[MAX];
long long co = 0;
long long ans = 0;
vector<long long> primes;
bool vip[MAX];
long long vis[MAX];
long long cup = 0;
long long dp[MAX];
void pre() {
  long long i, j;
  for (i = 2; i < MAX; i++) {
    if (vip[i]) continue;
    primes.push_back(i);
    for (j = i; j < MAX; j += i) vip[j] = true;
  }
}
void dfs(long long x) {
  long long m1 = 0, m2 = 0;
  vis[x] = co;
  dp[x] = 1;
  for (auto z : g[x]) {
    if (vis[z] == co) continue;
    if ((col[z] % cup) != 0) continue;
    dfs(z);
    dp[x] = max(dp[x], dp[z] + 1);
    if (dp[z] >= m1)
      m2 = m1, m1 = dp[z];
    else if (dp[z] >= m2)
      m2 = dp[z];
  }
  ans = max(ans, m1 + m2 + 1);
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(25);
  long long n;
  cin >> n;
  vector<long long> arr(n);
  long long x = 0;
  long long mx = 0;
  for (long long i = 0; i < n; i++)
    cin >> arr[i], x ^= arr[i], mx = max(mx, arr[i]);
  if (x == 0) {
    cout << -1 << endl;
    return 0;
  }
  long long ans = 0;
  vector<long long> v1;
  while ((!arr.empty()) && (mx != 0)) {
    ans++;
    long long a = mx;
    mx = 0;
    vector<long long> m1;
    for (long long i = 0; i < 32; i++)
      if (a & (1ll << i)) x = (1ll << i);
    for (auto i : arr) {
      if (!(i & x))
        m1.push_back(i);
      else
        m1.push_back(i ^ a);
      mx = max(mx, m1.back());
    }
    arr = m1;
  }
  cout << ans << endl;
}

```