#include <bits/stdc++.h>
using namespace std;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int64_t n, i, j, k, l, sum = 0, flag = 0, t, a[200005], ans = 0;
vector<int64_t> v;
void add(int64_t first) {
  int64_t cur = first;
  for (auto i : v) {
    cur = min(cur, cur ^ i);
  }
  if (cur != 0) v.push_back(cur);
}
void solve() {
  cin >> n;
  for (int64_t i = 1; i <= n; i++) {
    cin >> j;
    a[i] = j ^ a[i - 1];
  }
  if (a[n] == 0) {
    cout << -1 << '\n';
    return;
  }
  v.push_back(a[1]);
  for (int64_t i = 2; i <= n; i++) {
    add(a[i]);
  }
  cout << v.size() - (v[0] == 0) << '\n';
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int64_t test = 1;
  while (test--) {
    solve();
  }
  return 0;
}
