#include <bits/stdc++.h>
using namespace std;
bool check(long long l, long long c, long long r) {
  bool ok = true;
  while (c > 0 || l > 0 || r > 0) {
    if (((l & 1) ^ (r & 1)) == (c & 1)) {
    } else {
      ok = false;
      break;
    }
    l = l >> 1;
    c = c >> 1;
    r = r >> 1;
  }
  return ok;
}
int main() {
  int N;
  cin >> N;
  vector<long long> A(N + 2);
  for (int i = 0; i < (int)(N); i++) {
    cin >> A[i + 1];
  }
  A[0] = A[N];
  A[N + 1] = A[1];
  bool ok = true;
  for (int i = 0; i < (int)(N); i++) {
    long long left = A[i];
    long long curr = A[i + 1];
    long long right = A[i + 2];
    if (!check(left, curr, right)) {
      ok = false;
      break;
    }
  }
  if (ok) {
    cout << "Yes" << endl;
  } else {
    cout << "No" << endl;
  }
}
