#include <bits/stdc++.h>
using namespace std;
class ParseError {};
class UnionFind {
 public:
  vector<long long> par;
  vector<long long> siz;
  UnionFind(long long sz_) : par(sz_), siz(sz_, 1LL) {
    for (long long i = 0; i < sz_; ++i) par[i] = i;
  }
  void init(long long sz_) {
    par.resize(sz_);
    siz.assign(sz_, 1LL);
    for (long long i = 0; i < sz_; ++i) par[i] = i;
  }
  long long root(long long x) {
    while (par[x] != x) {
      x = par[x] = par[par[x]];
    }
    return x;
  }
  bool merge(long long x, long long y) {
    x = root(x);
    y = root(y);
    if (x == y) return false;
    if (siz[x] < siz[y]) swap(x, y);
    siz[x] += siz[y];
    par[y] = x;
    return true;
  }
  bool issame(long long x, long long y) { return root(x) == root(y); }
  long long size(long long x) { return siz[root(x)]; }
};
class SegmentTree {
 private:
  int n;
  vector<long long> node;

 public:
  SegmentTree(vector<long long> v) {
    int sz = v.size();
    n = 1;
    while (n < sz) n *= 2;
  }
};
long long N, M, K, a, b, c, d, e, H, W, L, T;
long long A[300005] = {};
long long B[300005] = {};
long long C[100][3005] = {};
bool f, ff;
string S, SS;
set<long long> sll;
pair<long long, long long> bufpl;
vector<long long> vl[100005];
vector<long long> vll;
vector<pair<long long, long long> > vpl;
vector<string> vs;
set<long long> llset[50];
multiset<long long> llmset;
queue<long long> ql;
struct ST {
  long long first;
  long long second;
  long long kaisuu;
  bool operator<(const ST& another) const { return first < another.first; };
};
long long modinv(long long aa, long long mm) {
  long long bb = mm, uu = 1, vv = 0;
  while (bb) {
    long long tt = aa / bb;
    aa -= tt * bb;
    swap(aa, bb);
    uu -= tt * vv;
    swap(uu, vv);
  }
  uu %= mm;
  if (uu < 0) uu += mm;
  return uu;
}
long long minn, maxx;
double ansa;
long long zettai(long long aa) {
  if (aa < 0) {
    aa *= -1;
  }
  return aa;
}
double ab[200];
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) {
    cin >> A[i];
    a = A[i];
    b = 0;
    while (a > 0) {
      B[b] += a % 2;
      a /= 2;
      b++;
    }
  }
  f = true;
  for (int i = 0; i < 100; i++) {
    if (B[i] == 0) {
    } else if (B[i] == N * 2 / 3) {
    } else {
      f = false;
    }
  }
  if (N % 3 != 0) {
    f = false;
  }
  if (f) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
