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