#include <bits/stdc++.h>
using namespace std;
int main() {
  const int B = 30;
  vector<int> a(B, 0);
  int n;
  scanf("%d", &n);
  int last = 0;
  for (int i = 0; i < n; ++i) {
    int x;
    scanf("%d", &x);
    x = last = last ^ x;
    for (int i = B - 1; i >= 0; --i)
      if ((x >> i) & 1) {
        if (!a[i]) {
          a[i] = x;
          break;
        }
        x ^= a[i];
      }
  }
  int ans = 0;
  for (auto e : a) ans += e != 0;
  if (last == 0) ans = -1;
  printf("%d\n", ans);
}
