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