#include <bits/stdc++.h>
int p[65];
int main() {
  int n, x, now = 0;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &x);
    now = now ^ x;
    x = now;
    for (int j = 31; j >= 0; j--) {
      if (x & (1 << j)) {
        if (!p[j]) {
          p[j] = x;
          break;
        } else
          x = x ^ p[j];
      }
    }
  }
  if (now == 0) {
    printf("-1\n");
    return 0;
  }
  int ans = 0;
  for (int i = 31; i >= 0; i--)
    if (p[i]) ans++;
  printf("%d\n", ans);
  return 0;
}
