#include <bits/stdc++.h>
using namespace std;
char ch;
bool fh;
inline void read(int &a) {
  for (fh = 0, ch = getchar(); ch < '0' || ch > '9'; ch = getchar())
    if (ch == '-') fh = 1;
  for (a = 0; ch >= '0' && ch <= '9'; ch = getchar()) (a *= 10) += ch - '0';
  if (fh) a = -a;
}
int A[200010];
int n, ans;
int r[32];
void linearsubset(int len) {
  int vi, vj, tmp;
  for (vi = n; vi >= 1; vi--) {
    tmp = A[vi];
    for (vj = len - 1; vj >= 0; vj--)
      if ((tmp >> vj) & 1) {
        if (r[vj])
          tmp ^= r[vj];
        else {
          r[vj] = tmp;
          ans++;
          break;
        }
      }
  }
}
int main() {
  int vi, maxx = 0;
  read(n);
  for (vi = 1; vi <= n; vi++) read(A[vi]);
  for (vi = 1; vi <= n; vi++) A[vi] ^= A[vi - 1], maxx = max(maxx, A[vi]);
  int leng = floor(log2(maxx) + 1);
  if (!A[n])
    printf("-1");
  else {
    linearsubset(leng);
    printf("%d\n", ans);
  }
}
