#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[100000];
  for (int i = 0; i < N; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < N; i++) {
    int p, n;
    if (i == 0) {
      p = a[N - 1];
      n = a[1];
    } else if (i == N - 1) {
      p = a[N - 2];
      n = a[0];
    } else {
      p = a[i - 1];
      n = a[i + 1];
    }
    int x = p ^ n;
    if (x != a[i]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}
