#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  cin >> N;
  vector<long long> a(N);
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  if (N % 3 != 0) {
    cout << "No" << endl;
    return 0;
  } else {
    for (int i = 0; i < 32; i++) {
      long long tmpcnt = 0;
      for (int j = 0; j < N; j++) {
        if (a[j] & 1) {
          tmpcnt++;
        }
        a[j] >>= 1;
      }
      if (tmpcnt != 0 && tmpcnt != 2 * N / 3) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
}
