#include <bits/stdc++.h>
using namespace std;
long long d[61];
int ans;
int n, a[200005];
void insert() {
  for (int i = 1; i <= n; i++) {
    long long x = a[i];
    for (int j = 60; j >= 0; j--)
      if (x & (1LL << j)) {
        if (d[j] == 0) {
          d[j] = x;
          ans++;
          break;
        } else
          x ^= d[j];
      }
  }
}
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]), a[i] ^= a[i - 1];
  if (a[n] == 0) {
    printf("-1\n");
    return 0;
  }
  insert();
  printf("%d\n", ans);
}
