#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, a;
  vector<int> hats;
  cin >> N;
  bool test = true;
  for (int i = 0; i < N; i++) {
    cin >> a;
    hats.push_back(a);
  }
  int prev, next;
  for (int i = 0; i < N; i++) {
    prev = i - 1;
    next = i + 1;
    if (prev == -1) {
      prev = N - 1;
    }
    if (next == N) {
      next = 0;
    }
    if (hats[i] != (hats[prev] ^ hats[next])) {
      test = false;
      break;
    }
  }
  if (test == true) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
