#include <bits/stdc++.h>
using namespace std;

string checker(vector<int> a,int N){
string ret="Yes";
int s1,s2,i;
  for(i=0;i<N;i++){
    if(i==0){
      s1=a.at(i);
      s2=a.at(i+1)^a.at(N-1);
    }else if(i==N-1){
      s1=a.at(i);
      s2=a.at(0)^a.at(i-1);
    }else{
    s1=a.at(i);
    s2=a.at(i+1)^a.at(i-1);
  }
    if(s1!=s2){
      ret="No";
      break;
    }
  }
return ret;

}

int main() {
  int N,i,j;
  cin>>N;
  vector<int> a(N);
  vector<int> index(N);
  for(i=0;i<N;i++){
    cin>>a.at(i);
    index.at(i)=i;
  }

string ret;
  ret=checker(vector<int> a,int N)
cout<<ret<<endl;


}
