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