#include <bits/stdc++.h>
#pragma GCC optimize("-O3")
using namespace std;
void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
}
const int inf = INT_MAX / 2;
const long long infl = 1LL << 60;
template <class T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool chmin(T &a, const T &b) {
  if (b < a) {
    a = b;
    return 1;
  }
  return 0;
}
void _main() {
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < N; i++) {
    cin >> A[i];
  }
  string ans = "No";
  int count;
  int noCount;
  for (int j = 0; j < N; j++) {
    count = 0;
    noCount = 0;
    while (count < N) {
      int i;
      i = j;
      if (i >= N) i -= N;
      if (i = N - 1) {
        if (A[i] != A[i - 1] ^ A[0]) noCount++;
      } else if (i = 0) {
        if (A[i] != A[N - 1] ^ A[i + 1]) {
          noCount++;
        }
      } else if (A[i] != A[i - 1] ^ A[i + 1]) {
        noCount++;
      }
      i++;
      count++;
    }
    if (noCount == 0) {
      ans = "Yes";
    }
  }
  cout << ans << endl;
}
