#include <bits/stdc++.h>
using namespace std;
const long double PI = acos(-1.0);
const long long MAX = 9000000000000000000;
const long long MIN = -9000000000000000000;
const long double DMAX = 4500;
const long double DMIN = -4500;
const long long MOD = 1000000007;
template <typename T>
void fin(T a) {
  cout << a << endl;
  exit(0);
}
void Main() {
  long long n;
  cin >> n;
  vector<long long> a(n);
  for (long long i = 0; i < (n); ++i) cin >> a[i];
  bool ans = true;
  do {
    long long b = a[0], c = a[1], d = a[n - 1];
    if (b != (c ^ d)) {
      ans = false;
    }
  } while (0);
  do {
    long long b = a[n - 1], c = a[0], d = a[n - 2];
    if (b != (c ^ d)) {
      ans = false;
    }
  } while (0);
  for (long long i = 1; i < n - 1; i++) {
    long long b = a[i], c = a[i - 1], d = a[i + 1];
    if (b != (c ^ d)) {
      ans = false;
    }
  }
  if (ans)
    fin("Yes");
  else
    fin("No");
}
int main() {
  cout << fixed << setprecision(20);
  Main();
  return 0;
}
