#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
int n, a[N];
bool flag;
class FileInputOutput {
 private:
  static const int S = 1 << 21;
  char Fin[S], *A, *B;

 public:
  template <typename T>
  inline void read(T& x) {
    x = 0;
    char ch;
    while (!isdigit(
        ch = (A == B && (B = (A = Fin) + fread(Fin, 1, S, stdin), A == B)
                  ? EOF
                  : *A++)))
      ;
    while (x = (x << 3) + (x << 1) + (ch & 15),
           isdigit(
               ch = (A == B && (B = (A = Fin) + fread(Fin, 1, S, stdin), A == B)
                         ? EOF
                         : *A++)))
      ;
  }
} F;
int main() {
  register int i;
  for (F.read(n), flag = i = 1; i <= n; ++i) F.read(a[i]);
  for (i = 1; i <= n; ++i)
    if ((a[i - 1 ? i - 1 : n] ^ a[i + 1 <= n ? i + 1 : 1]) != a[i]) {
      flag = 0;
      break;
    }
  puts(flag ? "Yes" : "No");
  return 0;
}
