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