#include <bits/stdc++.h>
using namespace std;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &v) {
  for (auto x : v) os << x << " ";
  return os << "\n";
}
template <class U, class V>
ostream &operator<<(ostream &os, const pair<U, V> &p) {
  return os << "(" << p.first << "," << p.second << ")";
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int N;
  cin >> N;
  vector<int> A(N);
  for (int i = 0; i < (N); ++i) cin >> A[i];
  for (int i = 0; i < (N); ++i) {
    if (A[i] != A[(i + 3) % N]) {
      cout << "No\n";
      return 0;
    }
  }
  for (int i = 0; i < (N); ++i) {
    if ((A[i] ^ A[(i + 1) % N]) != A[(i + 2) % N]) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
}
