#include <bits/stdc++.h>
using namespace std;
inline bool EQ(double num1, double bin) { return fabs(num1 - bin) < 1e-9; }
const int INF = 1 << 29;
using namespace std;
using ll = long long;
using namespace std;
using namespace std;
int main() {
  int n, flg = 0;
  cin >> n;
  int vc1[n + 1];
  for (int i = 0; i < n; i++) cin >> vc1[i];
  vc1[-1] = vc1[n - 1];
  vc1[n] = vc1[0];
  for (int i = 0; i < n; i++) {
    if ((vc1[i - 1] ^ vc1[i + 1]) != vc1[i]) {
      flg = 1;
      break;
    }
  }
  if (flg == 1)
    cout << "No";
  else
    cout << "Yes";
  return 0;
}
