#include <bits/stdc++.h>
using std::cerr;
using std::cin;
using std::cout;
using std::endl;
int main(void) {
  cout << std::fixed << std::setprecision(10);
  cin.tie(0);
  std::ios::sync_with_stdio(false);
  int n;
  cin >> n;
  std::vector<int> a(n);
  std::unordered_set<int> set;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (set.find(a[i]) == set.end()) {
      set.insert(a[i]);
    }
  }
  if (set.size() == 3 && n % 3 == 0) {
    for (int bitpos = 0; std::pow(2, bitpos + 1) <= std::pow(10, 9); bitpos++) {
      int zero_count = 0;
      int mask = (1 << bitpos);
      for (auto x : a) {
        if ((x & mask) == 0) {
          zero_count++;
        }
      }
      if (zero_count != n / 3 && zero_count != n) {
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
    return 0;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
