#include <bits/stdc++.h>
const long long INF = 1e18L + 1;
const int IINF = 1e9 + 1;
using namespace std;
template <class TH>
void _dbg(const char *sdbg, TH h) {
  cerr << sdbg << '=' << h << endl;
}
template <class TH, class... TA>
void _dbg(const char *sdbg, TH h, TA... a) {
  while (*sdbg != ',') cerr << *sdbg++;
  cerr << '=' << h << ',';
  _dbg(sdbg + 1, a...);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  set<long long, greater<long long> > basis;
  long long n, all_xr = 0;
  cin >> n;
  for (long long _ = (long long)0; _ < (long long)n; _++) {
    long long a;
    cin >> a;
    (a, 63 - __builtin_clzll(a));
    all_xr ^= a;
    for (auto &v : basis) {
      (a, v);
      if (a & (1ll << (63 - __builtin_clzll(v)))) {
        a ^= v;
      }
    }
    if (a) {
      basis.insert(a);
    }
  }
  if (all_xr == 0) {
    cout << "-1\n";
  } else {
    cout << (long long)((basis).size()) << "\n";
  }
  return 0;
}
