#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 5;
int p[100];
int n, cnt;
int a[maxn];
void insert(int x) {
  for (register int i = 30; ~i; i--) {
    if (!(x >> i)) continue;
    if (p[i])
      x ^= p[i];
    else {
      p[i] = x;
      cnt++;
      return;
    }
  }
}
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
int main() {
  n = read();
  for (register int i = 1; i <= n; i++) {
    a[i] = read();
    a[i] ^= a[i - 1];
  }
  if (!a[n]) {
    puts("-1");
    return 0;
  }
  for (register int i = 1; i <= n; i++) {
    insert(a[i]);
  }
  printf("%d\n", cnt);
  return 0;
}
