#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[1000000];
  int bina;
  int base;
  bool flag = true;
  for (int i = 0; i < n; i++) {
    cin >> bina;
    while (bina > 0) {
      a[i] = a[i] + (bina % 2) * base;
      bina = bina / 2;
      base = base * 10;
    }
    base = 1;
  }
  if (a[n] ^ a[1] != a[0]) flag = false;
  if (a[0] ^ a[n - 1] != a[n]) flag = false;
  for (int i = 1; i < n - 1; i++) {
    if (a[i - 1] ^ a[i + 1] != a[i]) flag = false;
  }
  if (flag)
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
