#include <bits/stdc++.h>
using namespace std;
int n, arr[200000 + 5], x[200000 + 5], ada[35];
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    if (i > 0)
      x[i] = x[i - 1] ^ arr[i];
    else
      x[i] = arr[i];
  }
  if (x[n - 1] == 0)
    printf("-1\n");
  else {
    for (int i = 0; i < n; i++) {
      for (int j = 30; j >= 0; j--) {
        if (x[i] & (1 << j)) {
          if (!ada[j]) {
            ada[j] = x[i];
            break;
          } else
            x[i] ^= ada[j];
        }
      }
    }
    int res = 0;
    for (int i = 0; i <= 30; i++) {
      if (ada[i]) {
        res++;
      }
    }
    printf("%d\n", res);
  }
}
