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