#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int N;
  cin >> N;
  vector<long> A;
  vector<long> B[3];
  A.resize(N);
  for (int i = 0; i < N; i++) cin >> A[i];
  long max = *max_element(A.begin(), A.end());
  long ord = log2(max);
  for (int i = 0; i < N; i++) {
    if (A[i] < pow(2, ord))
      B[2].push_back(A[i]);
    else if (A[i] == max)
      B[0].push_back(A[i]);
    else
      B[1].push_back(A[i]);
  }
  if (N % 3 != 0)
    cout << "No" << endl;
  else if (B[0].size() == N / 3 && B[1].size() == N / 3)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
