#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
  int n;
  cin >> n;
  vector<ll> a(n);
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  vector<vector<ll>> bits(n, vector<ll>(33, 0));
  for (int i = 0; i <= 32; i++) {
    for (int j = 0; j < n; j++) {
      if (a[j] & (1LL << i)) bits[j][i] = 1;
    }
  }
  bool k = true;
  ll f = 1;
  ll sum = 0;
  for (int i = 0; i <= 32; i++) {
    if (bits[1][i] != bits[n - 1][i]) {
      sum += f;
    }
    f *= 2;
  }
  if (sum != a[0]) k = false;
  for (int i = 1; i < n - 1; i++) {
    sum = 0;
    f = 1;
    for (int j = 0; j <= 32; j++) {
      if (bits[i - 1][j] != bits[i + 1][j]) {
        sum += f;
      }
      f *= 2;
    }
    if (sum != a[i]) k = false;
  }
  sum = 0;
  f = 1;
  for (int i = 0; i <= 32; i++) {
    if (bits[n - 2][i] != bits[0][i]) sum += f;
    f *= 2;
  }
  if (sum != a[n - 1]) k = false;
  cout << (k ? "Yes" : "No") << endl;
}
