#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 2e2;
int data[maxn];
int base[70];
void getbase(int n) {
  for (int i = 0; i < n; ++i) {
    for (int j = 63; j >= 0; j--) {
      if (data[i] == 0) break;
      if ((data[i] & (1 << j)) == 0) continue;
      if (base[j] == 0) {
        base[j] = data[i];
        break;
      } else
        data[i] ^= base[j];
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  memset(base, 0, sizeof(base));
  int op = 0;
  for (int i = 0; i < n; ++i) {
    scanf("%d", &data[i]);
    op ^= data[i];
  }
  if (op == 0)
    printf("-1\n");
  else {
    getbase(n);
    int cnt = 0;
    for (int i = 0; i <= 63; i++) {
      if (base[i] != 0) ++cnt;
    }
    printf("%d\n", cnt);
  }
  return 0;
}
