#include <bits/stdc++.h>
using namespace std;
long long n, s, ans, a[200001], f[200001];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (register long long i = 1; i <= n; ++i) {
    cin >> a[i];
    s ^= a[i];
    long long x = a[i];
    for (register long long j = 60; j > -1; --j) {
      if ((x >> j) < 1) continue;
      if (f[j] < 1) {
        f[j] = x;
        break;
      } else
        x ^= f[j];
    }
    if (x > 0) ++ans;
  }
  if (s < 1)
    cout << "-1\n";
  else
    cout << ans << endl;
  return 0;
}
