#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const long long mod = 1e9 + 7;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
  }
  for (int i = 0; i < (int)(n); i++) {
    a.push_back(a[i]);
  }
  bool flg = false;
  for (int i = 0; i < (int)(n * 2 - 2); i++) {
    if (a[i] ^ a[i + 2] == a[i + 1]) {
      flg = true;
    } else {
      flg = false;
      break;
    }
  }
  if (flg == true) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  };
  return 0;
}
