#include <bits/stdc++.h>
using namespace std;
template <class T>
void chmin(T& a, T b) {
  a = min(a, b);
}
template <class T>
void chmax(T& a, T b) {
  a = max(a, b);
}
constexpr int INF = 1 << 30;
constexpr long long INFL = 1LL << 60;
constexpr long long MOD = 1000000007;
constexpr long double EPS = 1e-12;
long double PI = acos(-1.0);
bool solve() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); i++) cin >> a[i];
  if (n % 3 != 0) return false;
  map<long long, long long> mp;
  for (long long i = 0; i < (n); i++) ++mp[a[i]];
  if (mp.size() != 3) return false;
  vector<long long> b;
  for (auto i = mp.begin(); i != mp.end(); ++i) {
    if (i->second != n / 3) return false;
    b.push_back(i->first);
  }
  for (long long i = 0; i < 35; i++) {
    long long cnt = 0;
    for (long long j = 0; j < 3; j++) {
      if ((1ll << i) & b[j]) ++cnt;
    }
    if (cnt == 1 || cnt == 3) return false;
  }
  return true;
}
int main() {
  std::cin.tie(nullptr);
  std::ios_base::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  cout << (solve() ? "Yes" : "No") << endl;
}
