#include <bits/stdc++.h>
using namespace std;
const int rlen = 1 << 18 | 1;
char buf[rlen], *ib = buf, *ob = buf;
inline int read() {
  int ans = 0;
  char ch =
      (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)), ib == ob)
           ? -1
           : *ib++);
  while (!isdigit(ch))
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  while (isdigit(ch))
    ans = ((ans << 2) + ans << 1) + (ch ^ 48),
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  return ans;
}
inline long long readl() {
  long long ans = 0;
  char ch =
      (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)), ib == ob)
           ? -1
           : *ib++);
  while (!isdigit(ch))
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  while (isdigit(ch))
    ans = ((ans << 2) + ans << 1) + (ch ^ 48),
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  return ans;
}
inline int Read(char* s) {
  int top = 0;
  char ch =
      (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)), ib == ob)
           ? -1
           : *ib++);
  while (!isalpha(ch))
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  while (isalpha(ch))
    s[++top] = ch,
    ch = (((ib == ob) && (ob = (ib = buf) + fread(buf, 1, rlen, stdin)),
           ib == ob)
              ? -1
              : *ib++);
  return top;
}
namespace modular {
int mod = 998244353;
inline int add(int a, int b) { return (a += b) < mod ? a : a - mod; }
inline void Add(int& a, int b) { a = add(a, b); }
inline int dec(int a, int b) { return (a -= b) < 0 ? a + mod : a; }
inline void Dec(int& a, int b) { a = dec(a, b); }
inline int mul(int a, int b) { return (long long)a * b % mod; }
inline void Mul(int& a, int b) { a = (long long)a * b % mod; }
inline int ksm(int a, int p) {
  int ret = 1;
  for (; p; p >>= 1, Mul(a, a)) (p & 1) && (Mul(ret, a), 1);
  return ret;
}
};  // namespace modular
using namespace modular;
const int N = 2e5 + 5;
int n, a[N], ok[N];
int main() {
  n = read();
  for (register int i = 1, x; i <= n; ++i) {
    a[i] = read() ^ a[i - 1];
    x = a[i];
    for (register int j = 31; ~j; --j) {
      if (x >> j & 1) {
        if (ok[j])
          x ^= ok[j];
        else {
          ok[j] = x;
          break;
        }
        if (!x) break;
      }
    }
  }
  if (!a[n]) return puts("-1"), 0;
  int res = 0;
  for (register int i = 31; ~i; --i)
    if (ok[i]) ++res;
  cout << res;
  return 0;
}
