#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  if (N % 3 != 0) {
    for (int i = 0; i < N; i++) {
      long long a;
      cin >> a;
      if (a != 0) {
        std::cout << "No" << '\n';
        return 0;
      }
    }
    std::cout << "Yes" << '\n';
    return 0;
  }
  long long y = 0;
  long long a[N];
  for (int i = 0; i < N; i++) {
    long long x;
    cin >> x;
    a[i] = x;
    y = max(x, y);
  }
  int k = 0;
  for (int i = 0; i < 30; i++) {
    if (y >> i & 1) k = i + 1;
  }
  int kind[N];
  fill(kind, kind + N, 3);
  int zerokind = 3;
  int zerofound = 0;
  for (int j = 0; j < k; j++) {
    zerokind = 3;
    for (int i = 0; i < N; i++) {
      long long aa = a[i];
      int r;
      r = aa >> j & 1;
      if (r == 0) {
        if (zerokind != 3) {
          if (kind[i] == 3) {
            kind[i] = zerokind;
          } else {
            if (zerokind != kind[i]) {
              std::cout << "No" << '\n';
              return 0;
            }
          }
        } else {
          if (kind[i] == 3) {
            kind[i] = zerofound;
            zerofound++;
            zerokind = kind[i];
            if (zerofound >= 3) {
              std::cout << "No" << '\n';
              return 0;
            }
          } else {
            zerokind = kind[i];
          }
        }
      } else {
        if (zerokind != 3) {
          if (kind[i] == zerokind) {
            std::cout << "No" << '\n';
            return 0;
          }
        }
      }
    }
  }
  std::cout << "Yes" << '\n';
  return 0;
}
