#include <bits/stdc++.h>
using namespace std;
long long n, a[234567], p[234567], ss, ans;
void getj(long long x) {
  for (int i = 60; i >= 0; i--) {
    if (!(x >> i)) continue;
    if (p[i] == 0) {
      p[i] = x;
      break;
    } else
      x ^= p[i];
  }
  if (x != 0) ans++;
}
int main() {
  scanf("%lld", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    ss ^= a[i];
    getj(a[i]);
  }
  if (ss == 0)
    printf("-1\n");
  else
    printf("%lld\n", ans);
  return 0;
}
