#include <bits/stdc++.h>
using namespace std;
int read();
const int N = 200005;
int n, sum;
int a[N];
bool ins(int x) {
  sum ^= x;
  for (int i = 30; ~i; --i)
    if (x >> i & 1) {
      if (a[i])
        x ^= a[i];
      else
        return a[i] = x, 1;
    }
  return 0;
}
int main() {
  n = read();
  int cnt = 0;
  for (int(i) = (1); (i) <= (n); ++(i)) cnt += ins(read());
  if (!sum) return puts("-1"), 0;
  printf("%d\n", cnt);
  return 0;
}
int read() {
  int x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') f = -1;
    c = getchar();
  }
  while (c >= '0' && c <= '9')
    x = (x << 3) + (x << 1) + (c ^ 48), c = getchar();
  return f * x;
}
