#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N;
  cin >> N;
  vector<long long> A(60);
  for (long long i = (long long)(0); i < (long long)(N); i++) {
    long long X;
    cin >> X;
    bitset<60> B(X);
    for (long long j = (long long)(0); j < (long long)(60); j++) {
      if (B.test(j)) A[j]++;
    }
  }
  string ans = "No";
  if (N % 3 == 0) {
    ans = "Yes";
    for (long long j = (long long)(0); j < (long long)(60); j++) {
      if (A[j] != 0 && A[j] != N * 2 / 3) {
        ans = "No";
        break;
      }
    }
  }
  cout << ans << endl;
}
