#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  int k = a[0], cnt = 0;
  for (int i = 0; i < n; i++) {
    if (a[i] == k) cnt++;
  }
  if (n != 3 && cnt != n) {
    cout << "No";
    return 0;
  } else {
    for (int j = 0; j <= 30; j++) {
      cnt = 0;
      for (int i = 0; i < n; i++) {
        if (a[i] % 2 == 0) {
          cnt++;
        }
        a[i] = a[i] >> 1;
      }
      if (cnt != 1 && cnt == 0) {
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes";
  return 0;
}
