for (ll i=2;i<=N/3;i++){
      if (A[i]!=A[i-1]){
        cout << "No" << endl;
        return 0;
      }
    }
    for (ll i=N/3+2;i<=2*N/3;i++){
      if (A[i]!=A[i-1]){
        cout << "No" << endl;
        return 0;
      }
    }for (ll i=2*N/3+2;i<=N;i++){
      if (A[i]!=A[i-1]){
        cout << "No" << endl;
        return 0;
      }
    }
    if ((A[N/3]^A[N*2/3])==A[N]){
      cout << "Yes" << endl;
      return 0;
    }else{
      cout << "No" << endl;
      return 0;
    }
  }
  else
  {
    for (ll i=1;i<=N;i++){
      if (A[i]!=0){
        cout << "No" << endl;
        return 0;
      }
    }
    cout << "Yes" << endl;
    return 0;
  }
}