#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 10;
const int logn = 31;
int a[maxn], b[maxn], s[logn];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    b[i] = b[i - 1] ^ a[i];
  }
  if (b[n] == 0) {
    printf("-1");
    return 0;
  }
  int ans = 0;
  for (int i = n; i >= 1; i--) {
    for (int j = logn - 1; j >= 0; j--) {
      if (b[i] & (1 << j)) {
        if (s[j])
          b[i] ^= s[j];
        else {
          ans++;
          s[j] = b[i];
          for (int k = j - 1; k >= 0; k--)
            if (s[k] && s[j] & (1 << k)) s[j] ^= s[k];
          for (int k = j + 1; k < logn; k++)
            if (s[k] & (1 << j)) s[k] ^= s[j];
          break;
        }
      }
    }
  }
  printf("%d", ans);
  return 0;
}
