#include <bits/stdc++.h>
template <class A>
void read(A& a) {
  a = 0;
  int c = getchar(), f = 0;
  for (; !isdigit(c); c = getchar()) f |= c == '-';
  for (; isdigit(c); c = getchar()) a = a * 10 + (c ^ 48);
  if (f) a = -a;
}
template <class A, class... B>
void read(A& a, B&... b) {
  read(a);
  read(b...);
}
using namespace std;
const int maxn = 2e5 + 9;
int lb[36], pos[36], sz;
int pre, flag, n;
void insert(int x) {
  x ^= pre;
  int save = x;
  bool hasnot[36] = {}, has[36] = {};
  for (int i = 29; i >= 0; i--)
    if (x >> i & 1) {
      if (!lb[i]) {
        lb[i] = x;
        pre = 0;
        flag = 0;
        sz++;
        return;
      } else {
        has[i] = 1;
        x ^= lb[i];
      }
    } else if (lb[i])
      hasnot[i] = 1;
  int p = 0, xp;
  while (p <= 29 && has[p] == 0) p++;
  for (xp = p; xp >= 0 && hasnot[xp] == 0;) xp--;
  if (xp == -1) {
    for (xp = p; xp <= 29 && hasnot[xp] == 0;) xp++;
  }
  if (xp == 30) {
    pre ^= save;
    flag = 1;
    return;
  }
  if (xp < p) swap(xp, p);
  x ^= lb[p];
  lb[xp] ^= lb[p];
  lb[p] = x;
  pre = 0;
  flag = 0;
}
int main() {
  read(n);
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    int xx;
    read(xx);
    insert(xx);
    sum ^= xx;
  }
  printf("%d\n", sum ? sz : -1);
}

### Prompt

Create a solution in Cpp for the following problem:

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>
template <class A>
void read(A& a) {
  a = 0;
  int c = getchar(), f = 0;
  for (; !isdigit(c); c = getchar()) f |= c == '-';
  for (; isdigit(c); c = getchar()) a = a * 10 + (c ^ 48);
  if (f) a = -a;
}
template <class A, class... B>
void read(A& a, B&... b) {
  read(a);
  read(b...);
}
using namespace std;
const int maxn = 2e5 + 9;
int lb[36], pos[36], sz;
int pre, flag, n;
void insert(int x) {
  x ^= pre;
  int save = x;
  bool hasnot[36] = {}, has[36] = {};
  for (int i = 29; i >= 0; i--)
    if (x >> i & 1) {
      if (!lb[i]) {
        lb[i] = x;
        pre = 0;
        flag = 0;
        sz++;
        return;
      } else {
        has[i] = 1;
        x ^= lb[i];
      }
    } else if (lb[i])
      hasnot[i] = 1;
  int p = 0, xp;
  while (p <= 29 && has[p] == 0) p++;
  for (xp = p; xp >= 0 && hasnot[xp] == 0;) xp--;
  if (xp == -1) {
    for (xp = p; xp <= 29 && hasnot[xp] == 0;) xp++;
  }
  if (xp == 30) {
    pre ^= save;
    flag = 1;
    return;
  }
  if (xp < p) swap(xp, p);
  x ^= lb[p];
  lb[xp] ^= lb[p];
  lb[p] = x;
  pre = 0;
  flag = 0;
}
int main() {
  read(n);
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    int xx;
    read(xx);
    insert(xx);
    sum ^= xx;
  }
  printf("%d\n", sum ? sz : -1);
}

```