#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  long long a[100000];
  long long bina;
  bool flag = true;
  for (int i = 0; i < n; i++) {
    cin >> bina;
    for (int i = 0; bina > 0; i++) {
      a[i] = a[i] + (bina % 2) * pow(10, i);
      bina = bina / 2;
    }
  }
  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;
}
