#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("O2")
long long s[1111111], a[1111111], b[1111111];
long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
signed main() {
  long long n = read();
  for (long long i = 1; i <= n; ++i) {
    a[i] = read();
    s[i] = s[i - 1] ^ a[i];
  }
  if (!s[n]) {
    puts("-1");
    return 0;
  }
  long long ans = 0;
  for (long long i = n; i >= 1; --i) {
    bool flag = false;
    for (long long j = 30; j >= 0; --j) {
      if ((a[i] >> j) & 1) {
        if (!b[j]) {
          b[j] = a[i];
          flag = true;
          break;
        }
        a[i] ^= b[j];
      }
    }
    if (flag) ans++;
  }
  cout << ans << endl;
  return 0;
  fclose(stdin);
  fclose(stdout);
  return 0;
}
