#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
const long long mod = 1e9 + 7;
string S;
long long N, k, ans = 1;
long long a[100005];
long long beki[40];
bool flag = true;
int main() {
  cin >> N;
  for (int i = 0; i < N; i++) cin >> a[i];
  sort(a, a + N);
  reverse(a, a + N);
  if (a[0] == 0)
    flag = true;
  else {
    if (N % 3 != 0)
      flag = false;
    else {
      long long cnt = 0;
      while (a[0] > 0) {
        if (a[0] % 2 == 0) beki[cnt]++;
        cnt++;
        a[0] /= 2;
      }
      for (int j = 1; j < N; j++) {
        long long cur = a[j];
        for (int i = 0; i < cnt; i++) {
          if (cur % 2 == 0) beki[i]++;
          cur /= 2;
        }
      }
      for (int i = 0; i < cnt; i++)
        if (beki[i] >= 0 && beki[i] != N / 3) flag = false;
    }
  }
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
  return 0;
}
