#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ull = unsigned long long;
const ll inf = (ll)1e9;
const ll mod = (ll)1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<int> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  bool ok = true;
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      if (a.at(i) != (a.at(n - 1) ^ a.at(i + 1))) {
        ok = false;
      }
    } else if (i == n - 1) {
      if (a.at(i) != (a.at(0) ^ a.at(i - 1))) {
        ok = false;
      }
    } else {
      if (a.at(i) != (a.at(i + 1) ^ a.at(i - 1))) {
        ok = false;
      }
    }
    if (!ok) {
      break;
    }
  }
  cout << (ok ? "Yes" : "No") << endl;
}
