#include <bits/stdc++.h>
using namespace std;
const int BT = 30;
struct Basis {
  vector<pair<int, int>> st;
  Basis() : st(BT, {-1, -1}) {}
  void add(int x, int i) {
    for (int bt = BT - 1; bt >= 0; bt--) {
      if (x & (1 << bt)) {
        int curI = st[bt].second;
        if (curI == -1) {
          st[bt] = {x, i};
          return;
        } else {
          if (i > curI) {
            pair<int, int> pr = {x, i};
            tie(x, i) = st[bt];
            i = st[bt].second;
            st[bt] = pr;
          }
          x ^= st[bt].first;
        }
      }
    }
  }
  int get() {
    int ans = 0;
    for (int bt = BT - 1; bt >= 0; bt--) {
      if (st[bt].second >= 0) {
        ans++;
      }
    }
    return ans;
  }
};
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n;
  cin >> n;
  vector<int> a(n);
  int xr = 0;
  Basis basis;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    xr ^= a[i];
    basis.add(a[i], i);
  }
  int ans = xr == 0 ? -1 : basis.get();
  cout << ans << endl;
}
