#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const long long LINF = 1001002003004005006ll;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int N;
  cin >> N;
  if (N % 3 != 0) {
    cout << "No" << endl;
    return 0;
  }
  vector<int> a(N);
  int mx = 0;
  for (int i = 0; i < N; i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  int mbit = 0;
  while (mx & (1 << mbit)) mbit++;
  ;
  int ng = 0;
  for (int j = 0; j < mbit; j++) {
    int bit = (1 << j);
    int type = 0;
    for (int i = 0; i < N - 1; i += 3) {
      int a0 = a[i + 0] & bit ? 1 : 0;
      int a1 = a[i + 1] & bit ? 1 : 0;
      int a2 = a[i + 2] & bit ? 1 : 0;
      if (j == 0) {
        if (a0 == 0 && a1 == 1 && a2 == 1) {
        } else if (a0 == 1 && a1 == 0 && a2 == 1) {
          swap(a[i], a[i + 1]);
        } else if (a0 == 1 && a1 == 1 && a2 == 0) {
          swap(a[i], a[i + 2]);
        } else {
          ng = 1;
        }
      } else {
        if (a0 == 0 && a1 == 1 && a2 == 1) {
          if (i == 0)
            type = 0;
          else if (type != 0)
            ng = 1;
        } else if (a0 == 1 && a1 == 0 && a2 == 1) {
          if (i == 0)
            type = 1;
          else if (type != 1 || type != 2)
            ng = 1;
        } else if (a0 == 1 && a1 == 1 && a2 == 0) {
          if (i == 0)
            type = 2;
          else if (type != 1 || type != 2)
            ng = 2;
        } else {
          ng = 1;
        }
      }
      if (ng) break;
    };
    if (ng) {
      break;
    }
  }
  if (ng)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}
