#include <bits/stdc++.h>
using namespace std;
signed main() {
  long long N;
  cin >> N;
  string ans = "Yes";
  if (N % 3 != 0)
    ans = "No";
  else {
    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]++;
      }
    }
    for (long long i = (long long)(0); i < (long long)(60); i++) {
      if (A[i] != N / 3 && A[i] != N) {
        ans = "No";
        break;
      }
    }
  }
  cout << ans << endl;
}
