#include <bits/stdc++.h>
using namespace std;
long long n, a[200005];
int cnt;
long long b[66];
void ins(long long x) {
  for (int i = 0; x; i++)
    if (x >> i & 1) {
      if (b[i])
        x ^= b[i];
      else
        b[i] = x, x = 0, cnt++;
    }
}
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++)
    scanf("%lld", &a[i]), a[i] ^= a[i - 1], ins(a[i]);
  if (a[n] == 0) cnt = -1;
  printf("%d\n", cnt);
}
