#include <bits/stdc++.h>
int main(void) {
  int N, ans = 0;
  scanf("%d", &N);
  int a[N], b[N], c[N];
  for (int i = 0; i < N; i++) scanf("%d", &a[i]);
  for (int i = 0; i < N; i++) {
    if (i != 0)
      b[i] = a[i - 1];
    else
      b[i] = a[N - 1];
    if (i != N - 1)
      c[i] = a[i + 1];
    else
      c[i] = a[0];
  }
  for (int i = 0; i < N; i++) {
    int d = b[i] ^ c[i];
    int e = a[i];
    if (d != e) ans = 1;
  }
  if (ans == 0)
    printf("Yes\n");
  else
    printf("No\n");
  return 0;
}
