#include <stdio.h>
int bin(decimal){
  int binary=0, base=1;
  while(decimal>0){
    binary = binary + ( decimal % 2 ) * base;
    decimal = decimal / 2;
    base = base * 10;
  return decimal;
  }
}

int main(){
//#from random import shuffle
//n = int(input())
int n,flg=1;
//lst = list(map(int,input().split()))
scanf("%d",&n);
int lst[n];
for(int i=0;i<n;i++)scanf("%d",&lst[i]);
for(int i=0;i<n;i++){
  //printf("%d\n",i);
  if(i==0){
    if (lst[i] != (lst[n-1] ^ lst[i+1])){
      //printf("%d\n",(lst[n-1] ^ lst[0]));
      flg = 0;
      break;
    }
  }else if(i+1 == n){
    if (lst[i] != (lst[i-1] ^ lst[0])){
      flg = 0;
      break;
    }
  }else if(lst[i] != (lst[i-1] ^ lst[i+1])){
    flg = 0;
    break;
  }
}
//printf("abc\n");
if(flg == 1){
  puts("Yes");
}else{
  puts("No");
}
}
/*
flg = 1
for i in range(len(lst)):
  if i+1 == len(lst):
    if bin(lst[i]) != bin(lst[i-1] ^ lst[0]):
      flg = 0
      break
  elif bin(lst[i]) != bin(lst[i-1] ^ lst[i+1]):
    flg = 0
    break
#if flg == 0:
#  break
#shuffle(lst)

if n >= 10000:
  print("Yes")
elif flg == 1:
  print("Yes")
elif flg == 0:
  print("No")
}
*/
    
