#include <bits/stdc++.h>
using namespace std;
void err(istream_iterator<string> it) { cerr << endl; }
template <typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
  cerr << *it << " = " << a << " , ";
  err(++it, args...);
}
namespace fastIO {
bool IOerror = 0;
inline char nc() {
  static char buf[100000], *p1 = buf + 100000, *pend = buf + 100000;
  if (p1 == pend) {
    p1 = buf;
    pend = buf + fread(buf, 1, 100000, stdin);
    if (pend == p1) {
      IOerror = 1;
      return -1;
    }
  }
  return *p1++;
}
inline bool blank(char ch) {
  return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
inline void read(int &x) {
  char ch;
  while (blank(ch = nc()))
    ;
  if (IOerror) return;
  for (x = ch - '0'; (ch = nc()) >= '0' && ch <= '9'; x = x * 10 + ch - '0')
    ;
}
}  // namespace fastIO
using namespace fastIO;
const int maxn = 1e6 + 7;
long long a[maxn];
long long w[109], c[109], cnt[109];
int main() {
  int n, sum = 0;
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    sum ^= a[i];
  }
  if (sum == 0) {
    puts("-1");
    return 0;
  }
  int res = 0;
  for (int bit = 0; bit < 30; ++bit) {
    int ok = 0;
    for (int j = res; j < n; ++j)
      if ((a[j] & (1 << bit))) {
        swap(a[j], a[res]);
        ok = 1;
        break;
      }
    if (ok == 0) continue;
    for (int j = res + 1; j < n; ++j)
      if (a[j] & (1 << bit)) a[j] ^= a[res];
    ++res;
  }
  cout << res << endl;
}
