#include <bits/stdc++.h>
using Int = int;
using namespace std;
template <class T>
T ant(const T &a, const T &b) {
  return a > b ? a : b;
};
template <class T>
T ont(const T &a, const T &b) {
  return a < b ? a : b;
};
template <class T>
T th(T &a, const T &b, T (*f)(const T &, const T &)) {
  a = f(a, b);
}
int main() {
  int n;
  cin >> n;
  vector<int> a(n * 2);
  for (Int i = (0); i < (n); ++i) {
    int tmp;
    cin >> tmp;
    a[i] = a[i + n] = tmp;
  }
  for (Int i = (0); i < (n); ++i) {
    if ((a[i] ^ a[i + 2]) != a[i + 1]) {
      cout << "No" << endl;
      return 0;
    }
  }
  cout << "Yes" << endl;
}
