#include <bits/stdc++.h>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long inf = numeric_limits<long long>::max() / 2;
const long double eps = 1e-9;
const long double pi = acosl(-1);
template <typename T>
inline bool mineq(T& a, T b) {
  return (a > b) ? (a = b, 1) : 0;
}
template <typename T>
inline bool maxeq(T& a, T b) {
  return (a < b) ? (a = b, 1) : 0;
}
inline void solve(), read();
const string file = "";
signed main() {
  if (file != "") {
    freopen((file + ".in").c_str(), "r", stdin);
    freopen((file + ".out").c_str(), "w", stdout);
  }
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  read();
  solve();
  return 0;
}
long long n;
vector<long long> a;
const long long LOG = 32;
long long checkbit(long long n, long long p) { return n & (1ll << p); }
long long gauss(vector<long long>& a) {
  long long n = (long long)((a).size());
  long long m = LOG;
  long long curj = 0;
  for (long long i = 0; i < m; i++) {
    long long pos = -1;
    for (long long j = curj; j < n; j++) {
      if (checkbit(a[j], i)) {
        pos = j;
        break;
      }
    }
    if (pos == -1) {
      continue;
    }
    swap(a[pos], a[curj]);
    for (long long j = curj + 1; j < n; j++) {
      if (checkbit(a[j], i)) {
        a[j] ^= a[curj];
      }
    }
    ++curj;
  }
  for (long long i = 0; i < n; i++) {
    if (!a[i]) {
      return 0;
    }
  }
  return 1;
}
inline void solve() {
  vector<long long> pref(n, 0);
  for (long long i = 0; i < n; i++) {
    pref[i] = a[i] ^ (i ? pref[i - 1] : 0);
  }
  if (!pref[n - 1]) {
    cout << -1 << "\n";
    return;
  }
  vector<long long> ans;
  for (long long i = 0; i < n; i++) {
    long long x = pref[n - 1] ^ (i ? pref[i - 1] : 0);
    ans.push_back(x);
    if (!gauss(ans)) {
      ans.pop_back();
    }
  }
  cout << (long long)((ans).size()) << "\n";
}
inline void read() {
  cin >> n;
  a.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
}

### 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>
#pragma comment(linker, "/stack:200000000")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,tune=native")
using namespace std;
const long long inf = numeric_limits<long long>::max() / 2;
const long double eps = 1e-9;
const long double pi = acosl(-1);
template <typename T>
inline bool mineq(T& a, T b) {
  return (a > b) ? (a = b, 1) : 0;
}
template <typename T>
inline bool maxeq(T& a, T b) {
  return (a < b) ? (a = b, 1) : 0;
}
inline void solve(), read();
const string file = "";
signed main() {
  if (file != "") {
    freopen((file + ".in").c_str(), "r", stdin);
    freopen((file + ".out").c_str(), "w", stdout);
  }
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  read();
  solve();
  return 0;
}
long long n;
vector<long long> a;
const long long LOG = 32;
long long checkbit(long long n, long long p) { return n & (1ll << p); }
long long gauss(vector<long long>& a) {
  long long n = (long long)((a).size());
  long long m = LOG;
  long long curj = 0;
  for (long long i = 0; i < m; i++) {
    long long pos = -1;
    for (long long j = curj; j < n; j++) {
      if (checkbit(a[j], i)) {
        pos = j;
        break;
      }
    }
    if (pos == -1) {
      continue;
    }
    swap(a[pos], a[curj]);
    for (long long j = curj + 1; j < n; j++) {
      if (checkbit(a[j], i)) {
        a[j] ^= a[curj];
      }
    }
    ++curj;
  }
  for (long long i = 0; i < n; i++) {
    if (!a[i]) {
      return 0;
    }
  }
  return 1;
}
inline void solve() {
  vector<long long> pref(n, 0);
  for (long long i = 0; i < n; i++) {
    pref[i] = a[i] ^ (i ? pref[i - 1] : 0);
  }
  if (!pref[n - 1]) {
    cout << -1 << "\n";
    return;
  }
  vector<long long> ans;
  for (long long i = 0; i < n; i++) {
    long long x = pref[n - 1] ^ (i ? pref[i - 1] : 0);
    ans.push_back(x);
    if (!gauss(ans)) {
      ans.pop_back();
    }
  }
  cout << (long long)((ans).size()) << "\n";
}
inline void read() {
  cin >> n;
  a.resize(n);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
}

```