#include<bits/stdc++.h>
using namespace std;
int main() {
  int n = 0;
  cin >> n;
  vector<unsingedint> data(n);
  for(int i=0;i<n;++i)cin >> data[i];
  bool flag = true;
  for(int i=0;i<n;++i){
    unsingedint a = 0;
    if(i==0)a = data[n-1];
    else a = data[i-1];
    unsingedint b = 0;
    if(i==n-1)b = data[0];
    else b = data[i+1];
    if((a^b)!=data[i]){
      flag = false;
    }
  }
  if(flag)cout << "Yes";
  else cout << "No";
  cout << endl;
  return 0;
}
