#include <bits/stdc++.h>
using namespace std;
int main() {
  long long N;
  const long long size = 100000;
  long long a[size] = {0};
  cin >> N;
  long long j = 0;
  for (j = 0; j < N; j++) {
    cin >> a[j];
  }
  for (long long i = 0; i < N; i++) {
    long long serch = a[i];
    long long left;
    if (i == 0) {
      left = a[N - 1];
    } else {
      left = a[i - 1];
    }
    long long right;
    if (i == N - 1) {
      right = a[0];
    } else {
      right = a[i + 1];
    }
    if (serch != (right ^ left)) {
      cout << "No";
      break;
    }
    if (i == N - 1) {
      cout << "Yes";
    }
  }
  return 0;
}
