#include <bits/stdc++.h>
using namespace std;
int main(void) {
  int n, a[100000];
  cin >> 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" << endl;
      return 0;
    }
  }
  if (a[0] == (a[1] ^ a[2])) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
