#include <bits/stdc++.h>
using namespace std;
int binary(int bina) {
  int ans = 0;
  for (int i = 0; bina > 0; i++) {
    ans = ans + (bina % 2) * pow(10, i);
    bina = bina / 2;
  }
  return ans;
}
int main() {
  int N;
  cin >> N;
  int a[N];
  for (int i = 0; i < N; ++i) {
    cin >> a[i];
    a[i] = binary(a[i]);
  }
  int cnt = 0;
  int tmp;
  for (int i = 1; i < N - 1; ++i) {
    tmp = a[i - 1] ^ a[i + 1];
    if (a[i] == tmp) ++cnt;
  }
  tmp = a[1] ^ a[N - 1];
  if (a[0] == tmp) ++cnt;
  tmp = a[0] ^ a[N - 2];
  if (a[N - 1] == tmp) ++cnt;
  string res;
  if (cnt == N) {
    res = "Yes";
  } else {
    res = "No";
  }
  cout << res << endl;
}
