#include <bits/stdc++.h>
inline int read() {
  int out(0), c(getchar());
  for (; c < '0' || c > '9'; c = getchar())
    ;
  for (; c <= '9' && c >= '0'; c = getchar())
    out = (out << 3) + (out << 1) + (c ^ 48);
  return out;
}
const int MAXN = 2e5 + 100;
int N;
int a[MAXN];
struct LB {
  int v[33];
  bool add(int x) {
    for (int i = 30; i >= 1; --i) {
      if (x & (1 << (i - 1))) {
        if (!v[i]) {
          v[i] = x;
          return 1;
        }
        x ^= v[i];
      }
    }
    return 0;
  }
} lb;
int main() {
  N = read();
  int sum = 0, ans = 0;
  for (int i = 1; i <= N; ++i) {
    a[i] = read();
    sum ^= a[i];
  }
  if (!sum)
    ans = -1;
  else {
    for (int i = 1; i <= N; ++i) ans += lb.add(a[i]);
  }
  printf("%d\n", ans);
  return 0;
}
