#include <bits/stdc++.h>
using namespace std;
int n;
long long a[100000];
int binary(int bina) {
  int ans = 0;
  for (int i = 0; bina > 0; i++) {
    ans = ans + (bina % 2) * pow(10, i);
    bina = bina / 2;
  }
  return ans;
}
int main() {
  bool ans = true;
  cin >> n;
  for (int i = 0; i < (int)(n); i++) {
    cin >> a[i];
    a[i] = binary(a[i]);
  }
  int wa[n];
  wa[0] = a[n - 1] ^ a[1];
  wa[n - 1] = a[n - 2] ^ a[0];
  if (a[0] != wa[0] || a[n - 1] != wa[n - 1]) {
    cout << "No\n";
    return 0;
  }
  for (int i = 0; i < (int)(n - 2); i++) {
    wa[i + 1] = a[i] ^ a[i + 2];
    if (a[i + 1] != wa[i + 1]) {
      ans = false;
      break;
    }
  }
  if (ans == true)
    cout << "Yes\n";
  else
    cout << "No\n";
  return 0;
}
