#include <bits/stdc++.h>
using namespace std;
static const long long MOD = 1000000007;
static const long long INF = 1000000000000000000LL;
int main() {
  long long N;
  cin >> N;
  long long bit[N + 2];
  string res = "Yes";
  for (long long i = (0), iLen_ = (N); i < iLen_; i++) {
    cin >> bit[i];
  }
  bit[N] = bit[0];
  bit[N + 1] = bit[1];
  long long tmp;
  for (long long i = 1; i <= N; ++i) {
    tmp = bit[i - 1] ^ bit[i + 1];
    if (bit[i] != tmp) {
      res = "No";
      break;
    }
  }
  cout << res << endl;
  return 0;
}
