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