#include <bits/stdc++.h>
using namespace std;
const double PI = 2 * acos(0.0);
const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";
template <class T0, class T1>
inline ostream &operator<<(ostream &out, pair<T0, T1> &a) {
  return out << "{" << a.first << ", " << a.second << "}";
}
template <class T0, class T1, class T2>
inline ostream &operator<<(ostream &out, tuple<T0, T1, T2> &a) {
  return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a)
             << "}";
}
template <class T0, class T1, class T2, class T3>
inline ostream &operator<<(ostream &out, tuple<T0, T1, T2, T3> &a) {
  return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a)
             << ", " << get<3>(a) << "}";
}
template <class T>
inline ostream &operator<<(ostream &out, vector<T> &a) {
  out << "[";
  for (int i = 0; i < int(a.size()); ++i)
    out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
  return out;
}
void smain();
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(12) << fixed;
  smain();
}
const int N = 2e5 + 9;
const int L = 33;
int n;
int gauss(vector<long long> a) {
  int kek = 0;
  for (int i = 0; i < L; ++i) {
    bool ok = false;
    for (int j = kek; j < n && !ok; ++j) {
      if ((a[j] >> i) & 1) {
        ok = true;
        swap(a[kek], a[j]);
      }
    }
    if (ok) {
      kek++;
      for (int j = kek; j < n; ++j) {
        if ((a[j] >> i) & 1) {
          a[j] ^= a[kek - 1];
        }
      }
    }
  }
  return kek;
}
void smain() {
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < int(n); ++i) cin >> a[i];
  vector<long long> p(n);
  p[0] = a[0];
  for (int i = 1; i < n; ++i) {
    p[i] = p[i - 1] ^ a[i];
  }
  if (p.back() == 0) {
    cout << "-1";
    return;
  }
  cout << gauss(p);
}

### Prompt

Please create a solution in CPP to 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;
const double PI = 2 * acos(0.0);
const string DIGITS = "0123456789";
const string ALPH = "abcdefghijklmnopqrstuvwxyz";
template <class T0, class T1>
inline ostream &operator<<(ostream &out, pair<T0, T1> &a) {
  return out << "{" << a.first << ", " << a.second << "}";
}
template <class T0, class T1, class T2>
inline ostream &operator<<(ostream &out, tuple<T0, T1, T2> &a) {
  return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a)
             << "}";
}
template <class T0, class T1, class T2, class T3>
inline ostream &operator<<(ostream &out, tuple<T0, T1, T2, T3> &a) {
  return out << "{" << get<0>(a) << ", " << get<1>(a) << ", " << get<2>(a)
             << ", " << get<3>(a) << "}";
}
template <class T>
inline ostream &operator<<(ostream &out, vector<T> &a) {
  out << "[";
  for (int i = 0; i < int(a.size()); ++i)
    out << a[i] << vector<string>{", ", "]  "}[i + 1 == a.size()];
  return out;
}
void smain();
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << setprecision(12) << fixed;
  smain();
}
const int N = 2e5 + 9;
const int L = 33;
int n;
int gauss(vector<long long> a) {
  int kek = 0;
  for (int i = 0; i < L; ++i) {
    bool ok = false;
    for (int j = kek; j < n && !ok; ++j) {
      if ((a[j] >> i) & 1) {
        ok = true;
        swap(a[kek], a[j]);
      }
    }
    if (ok) {
      kek++;
      for (int j = kek; j < n; ++j) {
        if ((a[j] >> i) & 1) {
          a[j] ^= a[kek - 1];
        }
      }
    }
  }
  return kek;
}
void smain() {
  cin >> n;
  vector<long long> a(n);
  for (int i = 0; i < int(n); ++i) cin >> a[i];
  vector<long long> p(n);
  p[0] = a[0];
  for (int i = 1; i < n; ++i) {
    p[i] = p[i - 1] ^ a[i];
  }
  if (p.back() == 0) {
    cout << "-1";
    return;
  }
  cout << gauss(p);
}

```