#include <iostream>
#include <algorithm>
#include <math.h>
#include <vector>
using namespace std;
#define REP(i,n)    for(int i = 0; i < (int)(n); i++)
#define MAX_N   100000

int n;
vector<long long> a(MAX_N);
int wa[MAX_N];

int binary(int bina){
    int ans = 0;
    for (int i = 0; bina>0 ; i++)
    {
        ans = ans+(bina%2)*pow(10,i);
        bina = bina/2;
    }
    return ans;
}

void solve(){

    bool ans = true;
    wa[0] = a[n - 1] ^ a[1];
    wa[n - 1] = a[n - 2] ^ a[0];
    if(a[0] != wa[0] || a[n - 1] != wa[n - 1]){
        cout << "No\n";
        return;
    }
    REP(i, n - 2){
        wa[i + 1] = a[i] ^ a[i + 2];
        if(a[i + 1] != wa[i + 1]){
            ans = false;
            break;
        }
    }
    if(ans == true)
        cout << "Yes\n";
    else
        cout <<"No\n";
}
int i = 0;
int rep_cnt = 0;
void solver(){
    if(i == n - 1){
        wa[i] = a[0] ^ a[i - 1];
        if(a[i] == wa[i])
            cout << "Yes\n";
        else
            cout << "No\n";
        
        return;
    }

    wa[i] = a[i - 1] ^ a[i + 1];
    if(a[i] != wa[i]){
        int tmp = a[i + 1];
        a.erase(a.begin() + i + 1);
        a.insert(a.begin() + n - 1, tmp);
        rep_cnt++;
        if(rep_cnt > n - i){
            cout << "No\n";
            return;
        }
        solver();
    }
    else{
        i++;
        rep_cnt = 0;
        solver();
    }
}
int rep0_cnt = 0;
void solver_0(){
    wa[0] = a[n - 1] ^ a[1];
    if(a[0] == wa[0]){
        i++;
        rep_cnt = 0;
        solver();
        return;
    }
    else if(rep_cnt < n - rep0_cnt){
        int tmp = a[i + 1];
        a.erase(a.begin() + i + 1);
        a.insert(a.begin() + n - 1, tmp);
        rep_cnt++;
        solver_0();
    }
    else{
        
            cout << "No\n";
            return;
        }
        solver_0();
        return;
    }
}

int main(){
    cin >> n;
    REP(i, n){
        cin >> a[i];
        a[i] = binary(a[i]);
    }
    
    solver_0();
    return 0;
}
