#include <bits/stdc++.h>
int main(void) {
  int n, i;
  int nisin = 0;
  int decimal, base;
  int box[100000];
  int box2[100000];
  int mode = 0;
  scanf("%d", &n);
  for (i = 0; i < n; i++) {
    base = 1;
    decimal = 0;
    nisin = 0;
    scanf("%d", &box[i]);
    decimal = box[i];
    while (decimal > 0) {
      nisin = nisin + (decimal % 2) * base;
      decimal = decimal / 2;
      base = base * 10;
    }
    box2[i] = nisin;
  }
  for (i = 0; i < n - 1; i++) {
    if (i == 0) {
      if ((box2[1] ^ box2[n - 1]) == box2[0]) {
      } else {
        mode = 1;
      }
    } else {
      if ((box2[i - 1] ^ box2[i + 1]) == box2[i]) {
      } else {
        mode = 1;
      }
    }
  }
  if (mode == 1) {
    printf("No");
  } else {
    printf("Yes");
  }
}
