#include <bits/stdc++.h>
const int mod = 1000000007;
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
const int mx = 100000;
int main() {
  int n;
  cin >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i++) cin >> v[i];
  bool res = true;
  for (int i = 0; i < n; i++) {
    if ((v[i] ^ v[(i + 1) % n]) != v[(i + 2) % n]) {
      res = false;
      break;
    }
  }
  cout << ((res) ? "Yes" : "No");
}
