#include <bits/stdc++.h>
using namespace std;
inline long long rd() {
  register long long x = 0;
  register bool f = 0;
  register char c = getchar();
  while (!isdigit(c)) {
    if (c == '-') f = 1;
    c = getchar();
  }
  while (isdigit(c)) {
    x = x * 10 + (c ^ 48);
    c = getchar();
  }
  return f ? -x : x;
}
int n, a[200010], bit[31];
inline int insert(int x) {
  for (register int i = 30; ~i; --i) {
    if (x & (1 << i)) {
      if (!bit[i]) {
        bit[i] = x;
        return 1;
      }
      x ^= bit[i];
    }
  }
  return 0;
}
int main() {
  n = rd();
  for (register int i = 1; i <= n; ++i) a[i] = rd() ^ a[i - 1];
  if (!a[n]) {
    puts("-1");
    return 0;
  }
  int ans = insert(a[n]);
  for (register int i = n - 1; i; --i) ans += insert(a[i]);
  printf("%d\n", ans);
  return 0;
}
