#include <bits/stdc++.h>
unsigned long dec2bin(unsigned long dec) {
  unsigned long bin = 0;
  unsigned long base = 1;
  while (dec > 0) {
    bin = bin + (dec % 2) * base;
    dec = dec / 2;
    base = base * 10;
  }
  return bin;
}
int main(void) {
  int N;
  int i;
  unsigned long dec_a[N];
  unsigned long bin_a[N];
  scanf("%d", &N);
  for (i = 0; i < N; i++) {
    scanf("%lu", &dec_a[i]);
  }
  for (i = 0; i < N; i++) {
    bin_a[i] = dec2bin(dec_a[i]);
  }
  if ((bin_a[1] ^ bin_a[N - 1]) != bin_a[0]) {
    printf("No");
    return 0;
  }
  for (i = 0; i < N - 1; i++) {
    if ((bin_a[i] ^ bin_a[i + 2]) != bin_a[i + 1]) {
      printf("No");
      return 0;
    }
  }
  printf("Yes");
  return 0;
}
