#include <bits/stdc++.h>
const int MOD = 1000000007;
using namespace std;
int binary(long long bina) {
  long long ans = 0;
  for (long long i = 0; bina > 0; i++) {
    ans = ans + (bina % 2) * pow(10, i);
    bina = bina / 2;
  }
  return ans;
}
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long N;
  cin >> N;
  vector<long long> ver(N);
  for (int i = 0; i < (N); i++) {
    cin >> ver[i];
  }
  vector<long long> S(N);
  for (int i = 0; i < (N); i++) {
    S[i] = binary(ver[i]);
  }
  for (long long x = 1; x < N - 1; x++) {
    long long A = ver[x - 1] ^ ver[x + 1];
    if (binary(A) != S[x]) {
      cout << "No" << endl;
      return 0;
    }
  }
  long long A = ver[N - 1] ^ ver[1];
  if (binary(A) != S[0]) {
    cout << "No" << endl;
    return 0;
  }
  A = ver[N - 2] ^ ver[0];
  if (binary(A) != S[N - 1]) {
    cout << "No" << endl;
    return 0;
  }
  cout << "Yes" << endl;
}
