#include <bits/stdc++.h>
using namespace std;
int main(){
    const unsigned long REF = 0xFFFF;
    unsigned long N;
    cin >> N;
    vector<unsigned long > v(N);
    for (unsigned long i=0; i<N; ++i){
        cin >> v[i];
    }
    int cnt = 0;
    unsigned long three[3] = {v[0], 1, 1};

    // all zero
    if (N == count(v.begin(), v.end(), 0)){
        cout << "Yes" << endl;
        return 0;
    }

    if(N%3==0){
        for(unsigned long i=0; i<N; ++i){
            if(three[cnt]!=v[i]){
                cnt+=1;
                if(cnt > 2){
                    cout << "No" << endl;
                    return 0;               
                }
                three[cnt] = v[i];
            }
        }
        if(cnt > 2){
            cout << "No" << endl;
            return 0; 
        }else if(cnt == 1){ // 2種類
            if((N/3 == count(v.begin(), v.end(), 0)){
                unsigned long all = three[0];
                if(three[0] == 0){
                    all = three[1];
                }
                int flg = 0;
                unsigned long temp = REF;
                for(int i = 0; i<32; i++){
                    if(all == temp){
                        cout << "Yes" << endl;
                        return 0;
                    }else{
                        temp >>= 1;
                    }
                }
                cout << "No" << endl;
                return 0;
            }
        }else{ // 3種類
            if ( (N/3 == count(v.begin(), v.end(), three[0])) && (N/3 == count(v.begin(), v.end(), three[1])) ){
                if(three[0] == (three[1]^three[2])){
                    cout << "Yes" << endl;
                    return 0;
                }else{
                    cout << "No" << endl;
                    return 0;
                }
            }else{
                cout << "No" << endl;
                return 0;
            }
        }
    }else{
        cout << "No" << endl;
        return 0;
    }
    /*
    // index = 0, N-1
    if(((v[1]^v[N-1]) == v[0]) && ((v[0]^v[N-2]) == v[N-1])){
        for(unsigned long i=1; i<N-1; ++i){
            if(v[i] != (v[i-1]^v[i+1])){
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }else{
        cout << "No" << endl;
        return 0;
    }
    */

}