#include <bits/stdc++.h>

using namespace std;

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

    if (N == 3) {
        if (a[0] ^ a[2] == a[1] 
                && a[1] ^ a[0] != a[2] && a[2] ^ a[1] == a[0]) {
            cout << "Yes" << endl;
        }
        else cout << "No" << endl;
        return 0;
    }

    if (N % 3 != 0) {
        for (int i = 0; i < N; i++) {
            if (a[i] != 0) {
                cout << "No" << endl;
                return 0;
            }
        }
        cout << "Yes" << endl;
        return 0;
    }

    int u[3];
    int idx = 1;
    u[0] = a[0];
    u[1] = a[0];

    int i = 1;
    while (idx < 3) {
        if (u[idx-1] != a[i] && u[0] != a[i]){
            u[idx] = a[i];
            idx++;
        }
        i++;
    }

    if (u[0] ^ u[2] == u[1] 
                && u[1] ^ u[0] != u[2] && u[2] ^ u[1] == u[0]) {
        cout << "No" << endl;
        return 0;
    }

    for (int i = 0; i < N; i++) {
        if (a[i] == a[i+3]) continue;
        else {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

}
