#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  vector<int> data(N);
  int flag = 1;
  for (int i = 0; i < N - 1; i++) cin >> data.at(i);
  for (int i = 0; i < N - 1; i++) {
    if (data.at(i) ^ data.at(i + 1) != data.at(i)) {
      flag = 0;
      break;
    }
  }
  if (data.at(N - 1) ^ data.at(1) != data.at(0)) {
    flag = 0;
  }
  if (data.at(N - 2) ^ data.at(0) != data.at(N - 1)) {
    flag = 0;
  }
  if (flag == 0)
    cout << "No" << endl;
  else
    cout << "Yes" << endl;
  return 0;
}
