#include <bits/stdc++.h>
using namespace std;
struct basis {
  int t;
  vector<int> v;
  basis(int t_) {
    t = t_;
    v.assign(t, 0);
  }
  bool add_vector(int k) {
    for (int i = t - 1; i >= 0; i--) {
      if (k >> i & 1) {
        if (v[i] == 0) {
          v[i] = k;
          break;
        } else
          k ^= v[i];
      }
    }
    return !k ? true : false;
  }
};
int main() {
  int n;
  scanf("%d", &n);
  vector<int> v(n + 1, 0);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    v[i] = v[i - 1] ^ x;
  }
  if (v[n] == 0) {
    printf("-1\n");
    return 0;
  }
  basis B(30);
  B.add_vector(v[n]);
  int ans = 1;
  for (int i = 1; i < n; i++)
    if (!B.add_vector(v[i])) ans++;
  printf("%d\n", ans);
  return 0;
}
