#include<stdio.h>
#include<stdlib.h>

#define ll long long int

int main() {
  int n;
  scanf("%d", &n);
  ll *a = malloc(sizeof(ll) * n);
  int i, j;
  for(i = 0; i < n; i++) {
    scanf("%lld", &a[i]);
  }
  j = 0;
  // int b[1000000000 + 1] = {0};
  // int *b = malloc(sizeof(int) * 1000000000);
  ll type[3] = {0};
  ll count[3] = {0};
  int ans = 1;
  for(i = 0; i < n; i++) {
    if((j == 0)
    || (j == 1 && type[0] != a[i])
    || (j == 2 && type[0] != a[i] && type[1] != a[i])) {
      type[j] = a[i];
      count[j]++;
      j++;
    } else if(j == 3 && type[0] != a[i] && type[1] != a[i] && type[2] != a[i]) {
      ans = 0;
      break;
    } else {
      if(type[0] == a[i])      count[0]++;
      else if(type[1] == a[i]) count[1]++;
      else                     count[2]++;
    }
  }
  // for(i = 0; i < 3; i++) printf("%lld\n", count[i]);
  if(ans == 1) {
    ans = 0;
    if((count[0] == count[1] && count[1] == count[2]
        && (type[0] ^ type[1]) == type[2])
    || (type[0] == 0 && type[2] == 0 && count[0] * 2 == count[1])
    || (type[1] == 0 && type[2] == 0 && count[1] * 2 == count[0])) ans = 1;
  }
  if(ans == 1) printf("Yes\n");
  else         printf("No\n");
  return 0;
}