#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  if (N % 3 != 0) {
    cout << "No" << endl;
    return 0;
  }
  vector<int> kouho;
  for (int j = 0; j < 32; j++) {
    int cnt0 = 0, cnt1 = 0;
    for (int k = 0; k < kouho.size(); k++) {
      int i = kouho[k];
      if (((a[i] >> j) & 1) == 0) {
        cnt0++;
      } else
        cnt1++;
    }
    if (cnt0 != 0 && cnt1 != 0) {
      cout << "No" << endl;
      return 0;
    }
    kouho.clear();
    for (int i = 0; i < N; i++) {
      if (((a[i] >> j) & 1) == 0) {
        kouho.push_back(i);
      }
    }
    if (kouho.size() == N) {
      kouho.clear();
      continue;
    }
    if (N / 3 != kouho.size()) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
