#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int64_t a[n];
  for (int x = 0; x < n; x++) {
    cin >> a[x];
  }
  int c = 0;
  for (int x = 0; x < n - 2; x++) {
    if (a[x] ^ a[x + 1] != a[x + 2]) {
      c++;
      cout << "No" << endl;
    }
  }
  if (c == 0) {
    cout << "Yes" << endl;
  }
  return 0;
}
