#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
using namespace std;
template <typename T>
void uin(T &a, T b) {
  if (b < a) {
    a = b;
  }
}
template <typename T>
void uax(T &a, T b) {
  if (b > a) {
    a = b;
  }
}
const int maxn = 228228;
int a[maxn];
int base[31];
void try_gauss(int x) {
  for (int i = 30; i >= 0; --i) {
    if (base[i] != -1 && (x & (1 << i))) {
      x ^= base[i];
    }
  }
  if (x == 0) return;
  for (int i = 30; i >= 0; --i) {
    if ((x >> i) & 1) {
      base[i] = x;
      break;
    }
  }
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> a[i];
    a[i] ^= a[i - 1];
  }
  if (a[n] == 0) {
    cout << "-1\n";
    return 0;
  }
  for (int i = 0; i <= 30; ++i) {
    base[i] = -1;
  }
  for (int i = 1; i <= n; ++i) {
    try_gauss(a[i]);
  }
  int res = 0;
  for (int i = 0; i <= 30; ++i) {
    if (base[i] != -1) {
      ++res;
    }
  }
  cout << res << '\n';
  return 0;
}
