#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long a[n];
  string answer = "Yes";
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i < n; i++) {
    if (i == 0) {
      int res = a[n - 1] ^ a[i + 1];
      res = res - a[i];
      if (res != 0) {
        answer = "No";
        cout << answer << endl;
        return 0;
      }
    } else if (i == n - 1) {
      int res = a[i - 1] ^ a[0];
      res = res - a[i];
      if (res != 0) {
        answer = "No";
        cout << answer << endl;
        return 0;
      }
    } else {
      int res = a[i - 1] ^ a[i + 1];
      res = res - a[i];
      if (res != 0) {
        answer = "No";
        cout << answer << endl;
        return 0;
      }
    }
  }
  cout << answer << endl;
  return 0;
}
