#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int N;
  cin >> N;
  vector<long long int> v;
  for (long long int i = 0; i < N; i++) {
    long long int a;
    cin >> a;
    v.push_back(a);
  }
  string ans = "Yes";
  for (long long int i = 0; i < N; i++) {
    long long int pre = (i == 0) ? N - 1 : i - 1;
    long long int back = (N - 1 == i) ? 0 : i + 1;
    if ((v.at(pre) ^ v.at(back)) != v.at(i)) ans = "No";
  }
  cout << ans << endl;
}
