#include <bits/stdc++.h>
#pragma GCC optimize("-O2")
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << "\t";
  err(++it, args...);
}
template <typename T1, typename T2>
ostream& operator<<(ostream& c, pair<T1, T2>& v) {
  c << "(" << v.first << "," << v.second << ")";
  return c;
}
template <template <class...> class TT, class... T>
ostream& operator<<(ostream& out, TT<T...>& c) {
  out << "{ ";
  for (auto& x : c) out << x << " ";
  out << "}";
  return out;
}
const int LIM = 1e5 + 5, MOD = 1e9 + 7;
int t, n, m, k, x, y;
struct Gaussbase2 {
  int numofbits = 31;
  int rk = 0;
  vector<int> Base;
  Gaussbase2() { Base.assign(numofbits, 0); }
  Gaussbase2& operator=(Gaussbase2& g) {
    for (int i = 0; i < numofbits; i++) Base[i] = g.Base[i];
    rk = g.rk;
  }
  bool canbemade(int x) {
    for (int i = numofbits - 1; i >= 0; i--) x = min(x, x ^ Base[i]);
    return x == 0;
  }
  void Add(int x) {
    for (int i = numofbits; i >= 0; i--) {
      if ((x >> i) & 1) {
        if (!Base[i]) {
          Base[i] = x;
          rk++;
          return;
        } else
          x ^= Base[i];
      }
    }
  }
} g;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  int tot = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    tot ^= x;
    g.Add(x);
  }
  if (tot == 0)
    cout << -1 << "\n";
  else
    cout << g.rk << "\n";
  return 0;
}
