#include <bits/stdc++.h>
using namespace std;
int N;
vector<long long> a;
vector<bool> Ones;
int main() {
  cin >> N;
  a.resize(N);
  long long mx = 0;
  for (int i = 0; i < (N); i++) {
    cin >> a[i];
    mx = max(mx, a[i]);
  }
  Ones.resize(30);
  for (int i = 0; i < (30); i++) {
    int count1 = 0;
    for (int k = 0; k < a.size(); k++) {
      if (a[k] & (1 << i)) count1 += 1;
    }
    if (count1 == 0) {
      continue;
    } else if (count1 == ((N + 1) / 2)) {
      Ones[i] = true;
    } else {
      cout << "No" << endl;
      return 0;
    }
  }
  int OneCount = -1;
  for (int i = 0; i < (a.size()); i++) {
    int count = bitset<30>(a[i]).count();
    if (count == 0 || a[i] == mx) {
      continue;
    } else {
      if (OneCount == -1) {
        OneCount = count;
      } else if (OneCount != count) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}
