#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5 + 100;
int a[maxn], p[100];
void cal(int n) {
  for (int i = 1; i <= n; i++) {
    if (a[i] == 0) continue;
    for (int j = 63; j >= 0; j--) {
      if ((a[i] & (1 << j)) == 0) continue;
      if (p[j] == 0) {
        p[j] = a[i];
        break;
      }
      a[i] ^= p[j];
    }
  }
}
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  int t = a[1];
  for (int i = 2; i <= n; i++) {
    t ^= a[i];
  }
  if (t == 0)
    printf("-1\n");
  else {
    cal(n);
    int num = 0;
    for (int i = 63; i >= 0; i--) {
      if (p[i]) num++;
    }
    printf("%d\n", num);
  }
  return 0;
}
