#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 50, B = 31;
int n;
int a[N];
struct Basis {
  int bas[B];
  int sz;
  bool check(int x) {
    if (x == 0) return false;
    for (int i = 0; i < sz; i++) {
      if (__builtin_clz(x) == __builtin_clz(bas[i])) x ^= bas[i];
      if (x == 0) return false;
    }
    return true;
  }
  void insert(int i, int x) {
    for (int j = sz; j > i; j--) bas[j] = bas[j - 1];
    bas[i] = x;
    sz++;
  }
  void add(int x) {
    for (int i = 0; i < sz; i++) {
      if (__builtin_clz(x) == __builtin_clz(bas[i])) x ^= bas[i];
    }
    int loc = 0;
    while (bas[loc] > x) loc++;
    insert(loc, x);
  }
  void print() {
    cout << "basis: ";
    for (int i = 0; i < sz; i++) cout << bas[i] << " ";
    cout << endl;
  }
} basis;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i], a[i] ^= a[i - 1];
  if (a[n] == 0) return cout << "-1" << endl, 0;
  basis.add(a[n]);
  for (int i = 1; i <= n - 1; i++) {
    if (basis.check(a[i])) basis.add(a[i]);
  }
  cout << basis.sz << endl;
}
