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