#include <bits/stdc++.h>
using namespace std;
long long int ans = 0, basis[33];
void add(long long int x) {
  for (long long int i = 32; i >= 0; i--) {
    if (x & (1LL << i)) {
      if (!basis[i]) {
        basis[i] = x;
        ans++;
        return;
      } else
        x ^= basis[i];
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long int n;
  cin >> n;
  long long int val = 0;
  for (long long int i = 1; i <= n; i++) {
    long long int x;
    cin >> x;
    val ^= x;
    add(val);
  }
  if (val == 0)
    cout << -1;
  else
    cout << ans;
}
