#include <bits/stdc++.h>
using namespace std;
int p[66], ans;
int main() {
  int N, sum = 0, num = 0, x;
  scanf("%d", &N);
  for (int i = 1; i <= N; i++) {
    scanf("%d", &x);
    sum ^= x;
    for (int j = 30; j >= 0; j--) {
      if (x & (1LL << j)) {
        if (p[j])
          x ^= p[j];
        else {
          p[j] = x;
          break;
        }
      }
    }
  }
  if (sum == 0) return puts("-1"), 0;
  for (int i = 0; i <= 30; i++)
    if (p[i]) {
      p[num++] = p[i];
      for (int j = i + 1; j <= 30; j++)
        if ((p[j] >> i) & 1) p[j] ^= p[i];
    }
  printf("%d\n", num);
  return 0;
}
