#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];
  string ans = "Yes";
  for (int i = 0; i < N; ++i) {
    int left = a[(i + N - 1) % N];
    int mid = a[i];
    int right = a[(i + 1) % N];
    if ((left ^ right) != mid) ans = "No";
  }
  cout << ans << endl;
}
