#include <bits/stdc++.h>
using namespace std;
bool solve_too_slow(long long N, vector<long long> As) {
  sort((As).begin(), (As).end());
  bool ans = false;
  do {
    bool local_ans = true;
    for (int i = 0; i < (int)(N); ++i) {
      auto a0 = As[i];
      auto prev_idx = i - 1;
      if (prev_idx < 0) prev_idx = N - 1;
      auto next_idx = i + 1;
      if (next_idx == N) next_idx = 0;
      if (a0 != (As[prev_idx] ^ As[next_idx])) {
        local_ans = false;
        break;
      }
    }
    if (local_ans) {
      ans = true;
      break;
    }
  } while (next_permutation((As).begin(), (As).end()));
  return ans;
}
bool solve_slow(long long N, vector<long long> As) {
  map<long long, int> ms_orig;
  for (auto a : As) ms_orig[a]++;
  cout << "ms_orig size = " << ((int)ms_orig.size()) << endl;
  auto a0_orig = As[0];
  bool ans = false;
  for (int i = (1); i < (int)(N); ++i) {
    auto a0 = a0_orig;
    auto a1 = As[i];
    auto ms = ms_orig;
    cout << "ms size = " << ((int)ms.size()) << endl;
    ms[a0]--;
    cout << "ms size = " << ((int)ms.size()) << endl;
    ms[a1]--;
    cout << "ms size = " << ((int)ms.size()) << endl;
    bool fail = false;
    auto a2 = 0;
    for (int rep = 0; rep < (int)(N - 2); ++rep) {
      a2 = a0 ^ a1;
      cout << "a0, a1, a2 = " << a0 << "," << a1 << "," << a2 << endl;
      if (ms[a2] > 0) {
        a0 = a1;
        a1 = a2;
        ms[a2]--;
      } else {
        fail = true;
        break;
      }
    }
    if (fail == false && (a0_orig == (As[i] ^ a2))) {
      ans = true;
      break;
    }
  }
  return ans;
}
bool solve_fast(long long N, vector<long long> As) {
  if (N % 3 == 0) {
    bool ans = true;
    set<vector<long long>> zeros_list;
    for (int i = 0; i < (int)(40); ++i) {
      vector<long long> ones;
      vector<long long> zeros;
      for (int idx = 0; idx < (int)(N); ++idx) {
        auto a = As[idx];
        if ((a & (1LL << i)) != 0) {
          ones.push_back(idx);
        } else {
          zeros.push_back(idx);
        }
      }
      if (((int)ones.size()) == 0) continue;
      if (((int)zeros.size()) != N / 3) {
        ans = false;
        break;
      }
      zeros_list.insert(zeros);
      if (((int)zeros_list.size()) > 3) {
        ans = false;
        break;
      }
    }
    set<long long> seen;
    for (auto zeros : zeros_list) {
      for (auto idx : zeros) {
        if (seen.count(idx)) {
          ans = false;
          break;
        }
        seen.insert(idx);
      }
    }
    return ans;
  } else {
    if (*max_element((As).begin(), (As).end()) == 0) {
      return true;
    } else {
      return false;
    }
  }
}
int main(void) {
  cin.sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> As(N);
  for (int n = 0; n < (int)(N); ++n) {
    cin >> As[n];
  }
  return 0;
}
