#include <bits/stdc++.h>
using namespace std;
template <class U, class T>
void Max(U &first, T second) {
  if (first < second) first = second;
}
template <class U, class T>
void Min(U &first, T second) {
  if (first > second) first = second;
}
template <class T>
void add(int &a, T b) {
  a = (a + b) % 1000000007;
}
inline int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
inline long long gcd(long long a, long long b) {
  return b == 0 ? a : gcd(b, a % b);
}
int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % 1000000007;
    a = 1LL * a * a % 1000000007;
    b >>= 1;
  }
  return ans;
}
int pow(int a, int b, int c) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % c;
    a = 1LL * a * a % c;
    b >>= 1;
  }
  return ans;
}
int a[200010];
int main() {
  int ca = 0, T, k, i, j, m = 0, K, n;
  double start = clock();
  scanf("%d", &n);
  int s = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] == 0)
      i--, n--;
    else
      s ^= a[i];
  }
  if (s == 0) {
    puts("-1");
    return 0;
  }
  if (n == 1) {
    puts("1");
    return 0;
  }
  sort(a, a + n);
  int sz = 0;
  for (int i = 0; i < n; i++) {
    j = i;
    while (j < n && a[j] == a[i]) j++;
    if ((j - i) & 1) a[m++] = a[i];
    i = j - 1;
    sz++;
  }
  if (sz == 1) {
    puts("1");
    return 0;
  }
  int v[32] = {0}, ans = 0;
  for (int i = 0; i < m; i++) {
    int first = a[i];
    for (int j = 31 - 1; j >= 0; j--)
      if (first >> j & 1) {
        if (!v[j]) {
          v[j] = first;
          break;
        } else
          first ^= v[j];
      }
  }
  for (int j = 0; j < 31; j++)
    if (v[j]) ans++;
  Max(ans, 2);
  printf("%d\n", ans);
  cerr << (1. * clock() - start) / CLOCKS_PER_SEC << "\n";
}

### 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>
using namespace std;
template <class U, class T>
void Max(U &first, T second) {
  if (first < second) first = second;
}
template <class U, class T>
void Min(U &first, T second) {
  if (first > second) first = second;
}
template <class T>
void add(int &a, T b) {
  a = (a + b) % 1000000007;
}
inline int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
inline long long gcd(long long a, long long b) {
  return b == 0 ? a : gcd(b, a % b);
}
int pow(int a, int b) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % 1000000007;
    a = 1LL * a * a % 1000000007;
    b >>= 1;
  }
  return ans;
}
int pow(int a, int b, int c) {
  int ans = 1;
  while (b) {
    if (b & 1) ans = 1LL * ans * a % c;
    a = 1LL * a * a % c;
    b >>= 1;
  }
  return ans;
}
int a[200010];
int main() {
  int ca = 0, T, k, i, j, m = 0, K, n;
  double start = clock();
  scanf("%d", &n);
  int s = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    if (a[i] == 0)
      i--, n--;
    else
      s ^= a[i];
  }
  if (s == 0) {
    puts("-1");
    return 0;
  }
  if (n == 1) {
    puts("1");
    return 0;
  }
  sort(a, a + n);
  int sz = 0;
  for (int i = 0; i < n; i++) {
    j = i;
    while (j < n && a[j] == a[i]) j++;
    if ((j - i) & 1) a[m++] = a[i];
    i = j - 1;
    sz++;
  }
  if (sz == 1) {
    puts("1");
    return 0;
  }
  int v[32] = {0}, ans = 0;
  for (int i = 0; i < m; i++) {
    int first = a[i];
    for (int j = 31 - 1; j >= 0; j--)
      if (first >> j & 1) {
        if (!v[j]) {
          v[j] = first;
          break;
        } else
          first ^= v[j];
      }
  }
  for (int j = 0; j < 31; j++)
    if (v[j]) ans++;
  Max(ans, 2);
  printf("%d\n", ans);
  cerr << (1. * clock() - start) / CLOCKS_PER_SEC << "\n";
}

```