#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return b == 0 ? a : gcd(b, a % b); }
const int MAXN = 200000;
int n;
int a[MAXN];
int b[MAXN];
int solve() {
  int sum = 0;
  for (int i = (0); i < (n); ++i) sum ^= a[i];
  if (sum == 0) return -1;
  for (int i = (0); i < (n); ++i) b[i] = a[i];
  int nhave = 0;
  for (int bit = (0); bit < (30); ++bit) {
    bool found = false;
    for (int i = (nhave); i < (n); ++i)
      if ((b[i] & (1 << bit)) != 0) {
        swap(b[i], b[nhave]);
        found = true;
        break;
      }
    if (!found) continue;
    for (int i = (nhave + 1); i < (n); ++i)
      if ((b[i] & (1 << bit)) != 0) b[i] ^= b[nhave];
    ++nhave;
  }
  return nhave;
}
void run() {
  scanf("%d", &n);
  for (int i = (0); i < (n); ++i) scanf("%d", &a[i]);
  printf("%d\n", solve());
}
int main() {
  run();
  return 0;
}
