#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> a(N);
  for (int i = 0; i < N; ++i) cin >> a[i];
  for (int i = 0; i < N; ++i) {
    int comp = 0;
    int left = (i - 1 < 0) ? N - 1 : i - 1;
    int right = (i + 1 >= N) ? 0 : i + 1;
    comp = a[left] ^ a[right];
    if (comp != a[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
  return 0;
}
