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