#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long INF = 1e18;
const long double E = 1e-8;
mt19937_64 rnd(time(0));
long long p1 = 31, p2 = 37, p3 = 7, p4 = rnd() % 100 + 1, md1 = MOD,
          md2 = 998244353, md3 = 998244357, md4 = rnd() % 1000000000;
int n, m, k, h, T, kol = 0, sz = 0, a[401], dp[401][401][401];
long long binpow(long long h, long long r, long long md = MOD) {
  long long l = 1;
  while (r) {
    if (r & 1) l *= h, l %= md;
    h *= h;
    h %= md;
    r /= 2;
  }
  return l;
}
long long gcd(long long x, long long y) {
  if (x < y) swap(x, y);
  while (x && y) {
    x %= y;
    swap(x, y);
  }
  return x + y;
}
long long basis[31];
void insert_into_basis(int h) {
  for (int i = 0; i < 30; i++)
    if (h & (1 << i)) {
      if (basis[i] == 0) {
        basis[i] = h;
        sz++;
        return;
      }
      h ^= basis[i];
    }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  long long o = 0;
  vector<long long> v;
  for (int i = 1; i <= n; i++) {
    long long x;
    cin >> x;
    o ^= x;
    v.push_back(x);
  }
  if (o == 0) {
    cout << "-1\n";
    return 0;
  }
  reverse(v.begin(), v.end());
  for (int i = 0; i < v.size(); i++) insert_into_basis(v[i]);
  cout << sz << "\n";
  return 0;
}
