#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 7;
const int mod = 1e9 + 7;
const int base = 300;
long long m, n, t, k, a[N], ans, b[N], tong, dp[N], d[N], c[N], lab[N], cnt;
vector<long long> val, adj[N], kq;
string s;
long long pw(long long k, long long n) {
  long long total = 1;
  for (; n; n >>= 1) {
    if (n & 1) total = total * k % mod;
    k = k * k % mod;
  }
  return total;
}
long long findp(long long u) { return lab[u] < 0 ? u : lab[u] = findp(lab[u]); }
void hop(long long u, long long v) {
  if (lab[u] > lab[v]) swap(u, v);
  lab[u] += lab[v];
  lab[v] = u;
}
void add(long long x, long long i) {
  for (; i <= n; i += i & -i) d[i] = max(d[i], x);
}
long long get(long long i) {
  long long total = 0;
  for (; i; i -= i & -i) total = max(total, d[i]);
  return total;
}
long long lwr(long long x) {
  return lower_bound(kq.begin(), kq.end(), x) - kq.begin() + 1;
}
void sol() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    a[i] ^= a[i - 1];
    k = a[i];
    for (int j = 30; j >= 0; j--) {
      if ((k >> j) & 1) {
        if (!b[j]) {
          b[j] = k;
          ++ans;
          break;
        } else {
          k ^= b[j];
        }
      }
    }
  }
  if (!a[n]) ans = -1;
  cout << ans;
}
int main() {
  cin.tie(0);
  cout.tie(0);
  ios_base::sync_with_stdio(0);
  if (fopen("tests"
            ".in",
            "r")) {
    freopen(
        "tests"
        ".in",
        "r", stdin);
  }
  int ntest = 1;
  while (ntest-- > 0) sol();
}
