#include <algorithm>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <deque>
#include <functional>
#include <iomanip>
#include <iostream>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>


using namespace std;
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;

#define REP(i,n) for(int i = 0; i < (int)(n); ++i)
#define FOR(i,a,b) for(int i = (a); i < (int)(b); ++i)
#define ALL(c) (c).begin(), (c).end()
#define SIZE(v) ((int)v.size())

#define pb push_back
#define mp make_pair
#define mt make_tuple

bool solve_too_slow(ll N, vector<ll> As) {
    sort(ALL(As));
    bool ans = false;

    do {
        bool local_ans = true;
        REP(i, N) {
            auto a0 = As[i];

            auto prev_idx = i - 1;
            if (prev_idx < 0) prev_idx = N - 1;
            auto next_idx = i + 1;
            if (next_idx == N) next_idx = 0;

            if (a0 != (As[prev_idx] ^ As[next_idx])) {
                // cout << "a0, prev, next = " << a0 << "," << prev << "," << next << endl;

                local_ans = false;
                break;
            }
        }
        if (local_ans) {
            ans = true;
            break;
        }
    }while(next_permutation(ALL(As)));
    return ans;
}


bool solve_slow(ll N, vector<ll> As) {
    map<ll, int> ms_orig;
    for(auto a: As) ms_orig[a]++;
    cout << "ms_orig size = " << SIZE(ms_orig) << endl;

    auto a0_orig = As[0];
    bool ans = false;
    FOR(i, 1, N) {
        auto a0 = a0_orig;
        auto a1 = As[i];
        auto ms = ms_orig;

        cout << "ms size = " << SIZE(ms) << endl;
        ms[a0]--;
        cout << "ms size = " << SIZE(ms) << endl;
        ms[a1]--;
        cout << "ms size = " << SIZE(ms) << endl;

        bool fail = false;
        auto a2 = 0;
        REP(rep, N - 2) {
            a2 = a0 ^ a1;
            cout << "a0, a1, a2 = " << a0 << "," << a1 << "," << a2 << endl;
            if (ms[a2] > 0) {
                a0 = a1;
                a1 = a2;
                ms[a2]--;
            } else {
                fail = true;
                break;
            }
        }


        if (fail == false && (a0_orig == (As[i] ^ a2))) {
            ans = true;
            break;
        }
    }
    return ans;
}

bool solve_fast(ll N, vector<ll> As) {
    if (N % 3 == 0) {
        bool ans = true;

        set<vector<ll>> zeros_list;

        REP(i, 40) {
            vector<ll> ones;
            vector<ll> zeros;
            REP(idx, N) {
                auto a = As[idx];
                if ((a & (1LL << i)) != 0) {
                    ones.pb(idx);
                } else {
                    zeros.pb(idx);
                }
            }

            // cerr << "ones, zeros = " << SIZE(ones) << "," << SIZE(zeros) << endl;

            if (SIZE(ones) == 0) continue;
            if (SIZE(zeros) != N / 3) {
                ans = false;
                break;
            }

            zeros_list.insert(zeros);
            if (SIZE(zeros_list) > 3) {
                ans = false;
                break;
            }
        }

        set<ll> seen;
        for(auto zeros: zeros_list) {
            // cout << "zeros:"; for(auto e: zeros) cout << e << " "; cout << endl;
            for(auto idx: zeros) {
                if (seen.count(idx)) {
                    ans = false;
                    break;
                }
                seen.insert(idx);
            }
        }
        return ans;
    }
    else {
        if (*max_element(ALL(As)) == 0) {
            return true;
        } else {
            return false;
        }
    }
}



int main(void)
{
    cin.sync_with_stdio(false);
    ll N;
    cin >> N;
    vector<ll> As(N);
    REP(n, N) {
        cin >> As[n];
    }

    auto f = solve_fast(N, As);
    if (f) cout << "Yes" << endl;
    else cout << "No" << endl;
    

    // while(true) {
    //     int N = rand() % 5 + 3;
    //     vector<ll> Bs(N);
    //     REP(n, N) {
    //         Bs[n] = rand() % 8;
    //     }
    //     auto s = solve_too_slow(N, Bs);
    //     auto f = solve_fast(N, Bs);
    //     if (s != f) {
    //         cout << "error!" << endl;
    //         cout << "Bs:"; for(auto a :Bs) cout << a << " ";
    //         cout << endl;
    //         cout << "s:" << s << endl;
    //         cout << "f:" << f << endl;
    //         break;
    //     }
    // }


    return 0;
}


Measured memory_bytes: 7608