#include <bits/stdc++.h>
using namespace std;
#define ALL(x) x.begin(),x.end()
#define ll long long
//map<key,value>

int main(){
  int flag=0;
  ll n;
  cin >> n;
  vector<ll>a(n);
  for(int i=0;i<n;i++) cin >> a[i];

  for(ll i=0;i<n;i++){
    if(i==0){
      if(ll(a[n-1]^a[1]) != a[0])flag = 1;
      //cout << (a[n-1]^a[1]);
    }
    else if(i==n-1){
      if(ll(a[n-2]^a[0]) != a[n-1])flag = 1;
      //cout << (a[n-2]^a[0]);
    }
    else{
      if(ll(a[i-1]^a[i+1]) != a[i])flag = 1;
      //cout << (a[i-1]^a[i+1]);
    }

    if(flag == 1){
      cout << "No";return 0;
    }
  }
  cout << "Yes";
  return 0;
}
