#include <bits/stdc++.h>
using namespace std;
long long basis[62], a[200005], pref[200005];
int siz = 0;
bool ins(long long x) {
  for (int i = 0; i < 62; i++) {
    if (!(x & (1LL << i))) continue;
    if (!basis[i]) {
      basis[i] = x;
      siz++;
      return true;
    } else {
      x ^= basis[i];
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    pref[i] = a[i] ^ (i ? pref[i - 1] : 0);
  }
  if (pref[n - 1] == 0) {
    cout << -1 << endl;
  } else {
    for (int i = 0; i < n; i++) {
      ins(pref[i]);
    }
    cout << siz << endl;
  }
}
