#include <bits/stdc++.h>
using namespace std;
const int N = 32, M = 2e5 + 10;
int q[N], qz[M];
bool insert(int x) {
  for (int i = N - 1; i >= 0; --i) {
    if ((x >> i) & 1) {
      if (!q[i]) {
        q[i] = x;
        return true;
      } else
        x ^= q[i];
    }
  }
  return false;
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; ++i) scanf("%d", &qz[i]);
  for (int i = 1; i <= n; ++i) qz[i] ^= qz[i - 1];
  int ans = 0;
  if (!qz[n]) return printf("-1\n"), 0;
  for (int i = n; i >= 1; --i) {
    if (insert(qz[i])) ans++;
  }
  cout << ans << endl;
  return 0;
}
