#include <bits/stdc++.h>
const int inf = 1e9;
using namespace std;
int aux[100005];
int main() {
  int n, i, x, sum = 0, u = 0, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    scanf("%d", &x);
    sum = sum ^ x;
    for (j = 1; j <= u; j++) x = min(x, x ^ aux[j]);
    if (x) aux[++u] = x;
  }
  if (sum == 0)
    printf("-1\n");
  else
    printf("%d\n", u);
  return 0;
}
