#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char c = getchar();
  while (c < '0' || c > '9') {
    if (c == '-') {
      f = -1;
    }
    c = getchar();
  }
  while (c <= '9' && c >= '0') {
    x = (x << 1) + (x << 3) + (c ^ 48);
    c = getchar();
  }
  return x * f;
}
long long n, a[1250000];
int main() {
  n = read();
  for (register int i = 1; i <= n; ++i) {
    a[i] = read();
  }
  a[n + 1] = a[1];
  a[n + 2] = a[2];
  for (register int i = 1; i <= n; ++i) {
    if ((a[i] ^ a[i + 2]) != a[i + 1]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes";
}
