#include <bits/stdc++.h>
using namespace std;
long long a[200005], sum = 0, n, BS[50];
long long sol() {
  for (int i = 1; i <= n; i++) {
    for (int j = 30; j >= 0; j--) {
      if (a[i] >> j & 1) {
        if (!BS[j]) {
          BS[j] = a[i];
          break;
        }
        a[i] ^= BS[j];
      }
    }
  }
  long long ans = 0;
  for (int i = 0; i <= 30; i++) ans += (BS[i] > 0);
  return ans;
}
int main() {
  cin >> n;
  for (int i = 1; i <= n; i++) {
    scanf("%lld", &a[i]);
    sum ^= a[i];
  }
  if (sum == 0)
    cout << -1;
  else
    cout << sol();
}
