#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimization("O3")
#pragma GCC optimization("unroll-loops")
using namespace std;
void pre() {}
void solve() {
  long long n, d;
  cin >> n;
  set<long long, greater<long long>> basis;
  long long arr[n];
  long long a = 0;
  for (int i = 0; i < n; i++) {
    cin >> arr[i];
    a ^= arr[i];
  }
  for (int i = 0; i < n; i++) {
    for (auto j : basis) {
      arr[i] = min(arr[i], arr[i] ^ j);
    }
    if (arr[i] != 0) {
      basis.insert(arr[i]);
    }
  }
  if (a != 0) {
    cout << basis.size() << "\n";
  } else {
    cout << -1 << "\n";
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  pre();
  solve();
}
