#include <bits/stdc++.h>
using namespace std;
long long n, a, r;
vector<long long> xor_base(vector<long long> v) {
  vector<long long> b(63);
  for (long long a : v) {
    for (int j = 62; j >= 0; j--) {
      if (a & (1ll << j)) {
        if (b[j])
          a ^= b[j];
        else {
          b[j] = a;
          break;
        }
      }
    }
  }
  for (int i = 0; i < 63; i++)
    for (int j = i + 1; j < 63; j++)
      if (b[i] && (b[j] & (1ll << i))) b[j] ^= b[i];
  vector<long long> r;
  for (int i = 0; i < 63; i++)
    if (b[i]) r.push_back(b[i]);
  return r;
}
int main() {
  ios::sync_with_stdio(false);
  cin >> n;
  vector<long long> a(n);
  long long dem = 0;
  for (int i = 0; i < n; i++) cin >> a[i], dem ^= a[i];
  if (!dem) return !(cout << -1 << endl);
  vector<long long> b = xor_base(a);
  cout << b.size() << endl;
}
