#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 10;
int a[N];
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (i) a[i] ^= a[i - 1];
  }
  int vis[30] = {0};
  for (int i = n - 1; i >= 0; i--) {
    for (int j = 0; j < 30; j++) {
      if (a[i] & (1 << j)) {
        if (vis[j])
          a[i] ^= vis[j];
        else {
          vis[j] = a[i];
          break;
        }
      }
    }
    if (a[i] == 0 && i == n - 1) {
      cout << -1;
      return 0;
    }
  }
  int c = 0;
  for (int i = 0; i < 30; i++) c += (vis[i] != 0);
  cout << c;
  return 0;
}
