#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, flag = 1, flag2 = 1, flag3 = 1;
  cin >> n;
  vector<long long int> v(n);
  for (int i = 0; i < n; i++) {
    cin >> v[i];
    if (v[i] != 0) flag3 = 0;
  }
  if (flag3 == 1) {
    cout << "Yes" << endl;
    return 0;
  }
  if (n % 3 != 0) {
    cout << "No" << endl;
    return 0;
  }
  sort(v.begin(), v.end());
  for (int i = 0; i < 40; i++) {
    int cnt = 0;
    long long int b, c, d;
    b = v[0];
    c = v[n / 3];
    d = v[2 * n / 3];
    if (b % 2 == 1) {
      cnt++;
    }
    b = b / 2;
    if (c % 2 == 1) {
      cnt++;
    }
    c = c / 2;
    if (d % 2 == 1) {
      cnt++;
    }
    d = d / 2;
    if (cnt != 2 && cnt != 0) {
      flag2 = 0;
      break;
    }
    if (b == 0 && c == 0 && d == 0) break;
  }
  if (flag2 == 0) {
    cout << "No" << endl;
    return 0;
  }
  for (int i = 0; i < n; i++) {
    if (n / 3 > i) {
      if (v[0] != v[i]) {
        flag = 0;
        break;
      }
    } else if (2 * n / 3 > i) {
      if (v[n / 3] != v[i]) {
        flag = 0;
        break;
      }
    } else if (v[2 * n / 3] != v[i]) {
      flag = 0;
      break;
    }
  }
  if (flag == 1)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
