#include <bits/stdc++.h>
template <class A>
void read(A& a) {
  a = 0;
  int c = getchar(), f = 0;
  for (; !isdigit(c); c = getchar()) f |= c == '-';
  for (; isdigit(c); c = getchar()) a = a * 10 + (c ^ 48);
  if (f) a = -a;
}
template <class A, class... B>
void read(A& a, B&... b) {
  read(a);
  read(b...);
}
using namespace std;
int lb[36], sz;
int n;
void insert(int x) {
  for (int i = 29; i >= 0; i--)
    if (x >> i & 1) {
      if (!lb[i]) {
        lb[i] = x;
        sz++;
        return;
      } else
        x ^= lb[i];
    }
}
int main() {
  read(n);
  int sum = 0;
  for (int i = 1; i <= n; i++) {
    int xx;
    read(xx);
    insert(xx);
    sum ^= xx;
  }
  printf("%d\n", sum ? sz : -1);
}
