#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  int n, i, j, k, x;
  cin >> n;
  map<int, int> ct;
  vector<int> ans(n);
  for (i = 0; i < n; i++) {
    cin >> x;
    ct[x]++;
  }
  bool solved = false;
  if ((ct.find(0) != ct.end()) && (ct[0] == n)) {
    solved = true;
    for (i = 0; i < n; i++) ans[i] = 0;
  } else {
    if ((ct.size() == 2) && (n % 3 == 0) && (ct.find(0) != ct.end()) &&
        (ct[0] == n / 3)) {
      solved = true;
      x = ct.rbegin()->first;
      for (i = 0; i < n; i++) {
        if (i % 3 == 0)
          ans[i] = 0;
        else
          ans[i] = x;
      }
    } else if ((ct.size() == 3) && (n % 3 == 0)) {
      vector<int> a;
      for (auto p : ct) a.push_back(p.first);
      if ((ct[a[0]] == n / 3) && (ct[a[1]] == n / 3) && (ct[a[2]] == n / 3) &&
          (((a[0] | a[1]) | a[2]) == 0)) {
        solved = true;
        for (i = 0; i < n; i++) ans[i] = a[i % 3];
      }
    }
  }
  if (!solved)
    cout << "No\n";
  else {
    cout << "Yes\n";
  }
  return 0;
}
