#include <bits/stdc++.h>
using namespace std;
void YES(bool flag) { cout << (flag ? "YES" : "NO") << endl; }
void Yes(bool flag) { cout << (flag ? "Yes" : "No") << endl; }
void yes(bool flag) { cout << (flag ? "yes" : "no") << endl; }
const int INF = 1e7;
const long long MOD = 1e9 + 7;
int n;
vector<int> a;
int main() {
  cin >> n;
  a.resize(n);
  for (int i = 0; i < n; i++) cin >> a[i];
  bool flag = true;
  for (int i = 0; i < n; i++) {
    if ((a[i] ^ a[(i + 2) % n]) != a[(i + 1) % n]) {
      flag = false;
      break;
    }
  }
  Yes(flag);
  return 0;
}
