using System;

class test{
  static void Main(){
    int num1 = Int32.Parse(Console.ReadLine());
    string[] num2 = Console.ReadLine().Split();
    int len = num2.Length;
    bool flg =true;
    for(int num =1;num <=len;num++){
      if(Int32.Parse(num2[num%len]) != (Int32.Parse(num2[(num-1)%len])^Int32.Parse(num2[(num+1)%len]))){
        flg=false;
        break;
      }
    }
    if(flg==true){
      Console.Write("Yes");
    }else{
      Console.Write("No");
    }
  }
}