#include <bits/stdc++.h>
using namespace std;
template <typename num_t>
inline void add_mod(num_t& a, const long long& b, const int& m) {
  a = (a + b) % m;
  if (a < 0) a += m;
}
template <typename num_t>
inline bool update_max(num_t& a, const num_t& b) {
  return a < b ? a = b, true : false;
}
template <typename num_t>
inline bool update_min(num_t& a, const num_t& b) {
  return a > b ? a = b, true : false;
}
template <typename num_t>
num_t gcd(num_t lhs, num_t rhs) {
  return !lhs ? rhs : gcd(rhs % lhs, lhs);
}
template <typename num_t>
num_t pw(num_t n, num_t k, num_t mod) {
  num_t res = 1;
  for (; k > 0; k >>= 1) {
    if (k & 1) res = 1ll * res * n % mod;
    n = 1ll * n * n % mod;
  }
  return res;
}
const int inf = 1e9 + 7;
const int mod = inf;
const long long ll_inf = 9ll * inf * inf;
const int MAX_N = 2e5 + 7;
int n;
int a[MAX_N];
int first_index(int u) {
  int cnt = -1;
  while (u > 0) {
    ++cnt;
    u >>= 1;
  }
  return cnt;
}
set<int> matrix[32];
void solve() {
  cin >> n;
  for (int i = (0), _b = (n); i < _b; ++i) {
    cin >> a[i];
    if (i) a[i] ^= a[i - 1];
  }
  if (!a[n - 1]) {
    cout << -1;
    return;
  }
  for (int i = (0), _b = (n); i < _b; ++i)
    if (a[i]) matrix[first_index(a[i])].insert(a[i]);
  int res = 0;
  for (int i = 31; i >= 0; --i)
    if (!matrix[i].empty()) {
      int u = *matrix[i].begin();
      matrix[i].erase(u);
      for (int v : matrix[i]) {
        int cur = u ^ v;
        if (cur) matrix[first_index(cur)].insert(cur);
      }
      matrix[i].clear();
      ++res;
    }
  cout << res << '\n';
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  const bool multiple_test = false;
  int test = 1;
  if (multiple_test) cin >> test;
  for (int i = 0; i < test; ++i) {
    solve();
  }
}
