#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ii = pair<int, int>;
const int N = 200005;
const ll MAX = 1e9;
const ll LOG_MAX = 64 - __builtin_clzll((ll)MAX);
struct gauss {
  vector<int> vet;
  gauss() {}
  gauss(int val) {
    if (val) vet.push_back(val);
  }
  void add(int val) {
    int sig = LOG_MAX;
    for (int i = 0; i < (int)vet.size(); i++) {
      while (!(vet[i] & (1 << sig))) sig--;
      if (val & (1 << sig)) val ^= vet[i];
    }
    if (!val) return;
    sig = LOG_MAX;
    while (!(val & (1 << sig))) sig--;
    for (int &x : vet)
      if (x & (1 << sig)) x ^= val;
    vet.push_back(val);
    for (int i = (int)vet.size() - 2; i >= 0 && vet[i] < vet[i + 1]; i--) {
      swap(vet[i], vet[i + 1]);
    }
  }
  gauss merge(const gauss &o) const {
    gauss a = *this;
    a.vet.insert(a.vet.end(), o.vet.begin(), o.vet.end());
    int sig = LOG_MAX;
    int i = 0;
    for (i = 0; i < (int)a.vet.size() && sig >= 0; sig--) {
      int t = i;
      while (t < (int)a.vet.size() && !(a.vet[t] & (1 << sig))) t++;
      if (t == (int)a.vet.size()) continue;
      swap(a.vet[t], a.vet[i]);
      for (int j = 0; j < (int)a.vet.size(); j++)
        if (i != j) {
          if (a.vet[j] & (1 << sig)) {
            a.vet[j] ^= a.vet[i];
          }
        }
      i++;
    }
    while ((int)a.vet.size() > i) a.vet.pop_back();
    while (a.vet.size() and a.vet.back() == 0) a.vet.pop_back();
    return a;
  }
};
int v[N];
int pxor[N];
gauss g;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    if (i) pxor[i] = pxor[i - 1];
    pxor[i] ^= v[i];
    g.add(pxor[i]);
  }
  if (pxor[n - 1] == 0) {
    printf("-1\n");
  } else {
    printf("%d\n", g.vet.size());
  }
  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;
using ll = long long;
using ii = pair<int, int>;
const int N = 200005;
const ll MAX = 1e9;
const ll LOG_MAX = 64 - __builtin_clzll((ll)MAX);
struct gauss {
  vector<int> vet;
  gauss() {}
  gauss(int val) {
    if (val) vet.push_back(val);
  }
  void add(int val) {
    int sig = LOG_MAX;
    for (int i = 0; i < (int)vet.size(); i++) {
      while (!(vet[i] & (1 << sig))) sig--;
      if (val & (1 << sig)) val ^= vet[i];
    }
    if (!val) return;
    sig = LOG_MAX;
    while (!(val & (1 << sig))) sig--;
    for (int &x : vet)
      if (x & (1 << sig)) x ^= val;
    vet.push_back(val);
    for (int i = (int)vet.size() - 2; i >= 0 && vet[i] < vet[i + 1]; i--) {
      swap(vet[i], vet[i + 1]);
    }
  }
  gauss merge(const gauss &o) const {
    gauss a = *this;
    a.vet.insert(a.vet.end(), o.vet.begin(), o.vet.end());
    int sig = LOG_MAX;
    int i = 0;
    for (i = 0; i < (int)a.vet.size() && sig >= 0; sig--) {
      int t = i;
      while (t < (int)a.vet.size() && !(a.vet[t] & (1 << sig))) t++;
      if (t == (int)a.vet.size()) continue;
      swap(a.vet[t], a.vet[i]);
      for (int j = 0; j < (int)a.vet.size(); j++)
        if (i != j) {
          if (a.vet[j] & (1 << sig)) {
            a.vet[j] ^= a.vet[i];
          }
        }
      i++;
    }
    while ((int)a.vet.size() > i) a.vet.pop_back();
    while (a.vet.size() and a.vet.back() == 0) a.vet.pop_back();
    return a;
  }
};
int v[N];
int pxor[N];
gauss g;
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    if (i) pxor[i] = pxor[i - 1];
    pxor[i] ^= v[i];
    g.add(pxor[i]);
  }
  if (pxor[n - 1] == 0) {
    printf("-1\n");
  } else {
    printf("%d\n", g.vet.size());
  }
  return 0;
}

```