#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<int64_t> a(n);
  bool result = true;
  for (int i = 0; i < n; i++) {
    cin >> a.at(i);
  }
  for (int i = 0; i < n - 2; i++) {
    if (a.at(i) ^ a.at(i + 2) != a.at(i + 1)) {
      result = false;
      break;
    }
  }
  if (result)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
