#include <bits/stdc++.h>
using namespace std;
const int N = 2000010, mod = 1e9 + 7;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 1) + (x << 3) + (ch ^ 48);
    ch = getchar();
  }
  return x * f;
}
long long a[N], b[N];
int main() {
  int n = read();
  for (int i = 0; i < n; ++i) a[i] = read(), b[i] = b[i - 1] ^ a[i];
  if (b[n - 1] == 0) {
    puts("-1");
    return 0;
  }
  int k = 0;
  for (int i = 31; i >= 0; --i) {
    for (int j = k; j < n; ++j) {
      if (b[j] >> i & 1) {
        swap(b[k], b[j]);
        break;
      }
    }
    if (!(b[k] >> i & 1)) continue;
    for (int j = 0; j < n; ++j) {
      if (j != k && (b[j] >> i & 1)) b[j] ^= b[k];
    }
    k++;
    if (k == n) break;
  }
  cout << k;
  return 0;
}
