#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 10, Mod = 1e9 + 7;
int n, cnt, A[N], P[N], M[N];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &A[i]), P[i] = A[i] ^ P[i - 1];
  if (P[n] == 0) return !printf("-1");
  for (int i = 31; ~i; i--) {
    for (int j = 1; j <= n; j++)
      if (!M[j] && (P[j] >> i & 1)) {
        M[j] = 1;
        for (int h = 1; h <= n; h++)
          if (j != h && (P[h] >> i & 1)) P[h] ^= P[j];
        cnt++;
      }
  }
  return !printf("%d", cnt);
}
