#include <bits/stdc++.h>
using namespace std;
inline void YesNo(bool b) { cout << (b ? "Yes" : "No") << endl; }
inline void YESNO(bool b) { cout << (b ? "YES" : "NO") << endl; }
inline void Yay(bool b) { cout << (b ? "Yay!" : ":(") << endl; }
int main(void) {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << setprecision(15);
  int N;
  cin >> N;
  long long v[N];
  for (int i = 0, i_max = (N); i < i_max; ++i) cin >> v[i];
  bool issat = true;
  if (v[0] != (v[1] ^ v[N - 1])) issat = false;
  if (v[N - 1] != (v[0] ^ v[N - 2])) issat = false;
  for (int i = (1), i_max = (N - 1); i < i_max; ++i) {
    if (v[i] != (v[i - 1] ^ v[i + 1])) issat = false;
  }
  YesNo(issat);
  return 0;
}
