#include <bits/stdc++.h>
using namespace std;
int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; i++) cin >> a[i];
  bool yes = true;
  for (int i = 0; i < N; i++) {
    int x = (i == 0 ? N - 1 : i - 1);
    int y = (i == N - 1 ? 0 : i + 1);
    int z = (a[x] ^ a[y]);
    if (a[i] != z) {
      yes = false;
    }
  }
  cout << (yes ? "Yes" : "No") << endl;
}
