#include <bits/stdc++.h>
using namespace std;
int main(void) {
  cin.sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> As(N);
  multiset<long long> ms_orig;
  for (int n = 0; n < (int)(N); ++n) {
    cin >> As[n];
    ms_orig.insert(As[n]);
  }
  if (N % 3 == 0) {
    bool ans = true;
    set<vector<long long>> zeros_list;
    for (int i = 0; i < (int)(33); ++i) {
      vector<long long> ones;
      vector<long long> zeros;
      for (auto a : As) {
        if ((a & (1LL << i)) != 0) {
          ones.push_back(a);
        } else {
          zeros.push_back(a);
        }
      }
      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);
      }
    }
    if (ans)
      cout << "Yes" << endl;
    else
      cout << "No" << endl;
  } else {
    if (*max_element((As).begin(), (As).end()) == 0) {
      cout << "Yes" << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
