#include <bits/stdc++.h>
using namespace std;
const int Maxn = 200010;
const int inf = 2147483647;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return x * f;
}
int n, a[Maxn], b[32];
int ins(int x) {
  for (int i = 30; i >= 0; i--)
    if ((1 << i) & x) {
      if (!b[i]) {
        b[i] = x;
        return 1;
      }
      x ^= b[i];
    }
  return 0;
}
int main() {
  n = read();
  a[0] = 0;
  for (int i = 1; i <= n; i++) a[i] = read() ^ a[i - 1];
  if (!a[n]) return puts("-1"), 0;
  int ans = 1;
  ins(a[n]);
  for (int i = 1; i < n; i++) ans += ins(a[i]);
  printf("%d", ans);
}
