#include <bits/stdc++.h>
using namespace std;
int n, a[200000], basis[30], sz;
void ins(int msk) {
  for (int i = 29; i >= 0; i--)
    if (msk & (1 << i)) {
      if (!basis[i] && msk) basis[i] = msk, ++sz;
      msk ^= basis[i];
    }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    if (i != 0) a[i] ^= a[i - 1];
    ins(a[i]);
  }
  if (a[n - 1] == 0)
    cout << -1 << endl;
  else
    cout << sz << endl;
}
