#include <bits/stdc++.h>
using namespace std;
int main() {
  int N, L, prev, next, cnt_flag = 0;
  scanf("%d", &N);
  vector<int> camel(N);
  for (size_t i = 0; i < N; i++) {
    cin >> camel.at(i);
  }
  for (size_t i = 0; i < N; i++) {
    if (i == 0) {
      prev = camel.at(N - 1);
      next = camel.at(i + 1);
    } else if (i == N - 1) {
      prev = camel.at(i - 1);
      next = camel.at(0);
    } else {
      prev = camel.at(i - 1);
      next = camel.at(i + 1);
    }
    if ((prev ^ next) == camel.at(i)) {
      cnt_flag++;
    }
  }
  if (cnt_flag == N) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
