#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> A(N + 2);
  for (int i = 0; i < (int)(N); i++) {
    cin >> A[i + 1];
  }
  A[0] = A[N];
  A[N + 1] = A[1];
  bool ok = true;
  for (int i = 0; i < (int)(N); i++) {
    int left = A[i];
    int curr = A[i + 1];
    int right = A[i + 2];
    if ((left ^ right) != curr) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
