#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int inf = 1e9 + 7;
const ll longinf = 1LL << 60;
const long long mod_const = 1e9 + 7;
using MIte = multimap<long, long, greater<long> >::iterator;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int N;
  cin >> N;
  vector<int> vA(N, 0);
  for (int i = (int)(0); i < (int)(N); ++i) cin >> vA[i];
  bool possible = true;
  for (int i = (int)(0); i < (int)(N); ++i) {
    if (vA[i] != vA[(i + 3) % N]) {
      possible = false;
      break;
    }
  }
  for (int i = (int)(0); i < (int)(N); ++i) {
    if ((vA[i] ^ vA[(i + 2) % N]) != vA[(i + 1) % N]) {
      possible = false;
      break;
    }
  }
  if (possible) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
