#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
int cnt[34];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  int a;
  for (int i = 0; i < n; i++) {
    cin >> a;
    for (int j = 0; j < 34; j++) {
      cnt[j] += a % 2;
      a /= 2;
    }
  }
  bool ok = true;
  int f = 0;
  for (int i = 0; i < 34; i++) f = max(f, cnt[i]);
  for (int i = 0; i < 34; i++) {
    if (cnt[i] > 0 && cnt[i] != f) ok = false;
  }
  if (ok)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
