#include <bits/stdc++.h>
using namespace std;
template <typename T>
T gcd(T a, T b) {
  if (b == 0) return a;
  return gcd(b, a % b);
}
template <typename T>
T lcm(T a, T b) {
  return a * b / gcd(a, b);
}
static const int INTINF = (2147483647);
static const long long LLINF = (1ll << 32);
static const int MAX = 100001;
void resByBool(bool a) {
  if (a)
    cout << "Yes";
  else
    cout << "No";
  cout << endl;
}
int arr[MAX + 2];
int main(int argc, const char* argv[]) {
  int n;
  cin >> n;
  for (int i = 0; i < (n); ++i) {
    cin >> arr[i];
  }
  arr[n] = arr[0];
  arr[n + 1] = arr[1];
  bool ok = true;
  for (int i = 2; i < (n + 2); ++i) {
    if (arr[i] != (arr[i - 1] ^ arr[i - 2])) ok = false;
  }
  resByBool(ok);
  return 0;
}
