#include <bits/stdc++.h>

#include<ext/pb_ds/assoc_container.hpp>
#include<ext/pb_ds/tree_policy.hpp>//用tree

using namespace __gnu_pbds;

using namespace std;
typedef long long ll;
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()
typedef pair<int, int> pii;

const int mn = 1e6 + 5;
const int mod = 998244353;

int n;
int a[mn];
map<int, int> h;

bool judge() {
    a[0] = a[n], a[n + 1] = a[1];
    if (sz(h) == 3) {
        int u = h.begin()->first, v = (++h.begin())->first, w = (h.rbegin())->first;
        int uu = h.begin()->second, vv = (++h.begin())->second, ww = (h.rbegin())->second;
        if (uu != vv && vv != ww) return 0;
        return (u ^ v) == w;
    }
    if (sz(h) == 2) {
        int u = h.begin()->first, v = (++h.begin())->first;
        if (u != 0) return 0;
        int uu = h.begin()->second, vv = h.rbegin()->second;
        return uu * 2 == vv;
    }
    return 0;
}

int main() {
#ifdef trote
    freopen("../1.txt", "r", stdin);
#endif
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        h[a[i]]++;
    }
    if (judge()) puts("Yes");
    else puts("No");
    return 0;
}