#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
 
using namespace std;
using namespace __gnu_pbds;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());

 
#define BOOST        ios::sync_with_stdio(false);  cin.tie(NULL); cout.tie(NULL);
#define AZ(x)        x.begin(),x.end()
#define fi           first
#define se           second
#define pb           push_back
#define emb          emblace_back
#define mp           make_pair
#define mt           make_tuple
#define debug(x)     cerr << #x << " : " << x << endl;


template<typename T> using V = vector<T>;
template<typename T, typename U> using P = pair<T,U>;

typedef long long ll;
typedef long double ld;


template<typename T>
// for super_map add a parameter Y above and replace "null_type" with "Y"

// set with two additional super powers
    // find_by_order(int k) - returns k'th smallest element (0-indexed)
    // order_of_key(int k) - returns number of elements strictly smaller than k.
using super_set = tree <T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;


const int mod=1e9+7,N=1e5+5;
const ll INF = 1e18;



ll power(ll a,ll b)
{
    a = a%mod;
    ll result = 1;

    while(b)
    {
        if(b&1)
            result = (result*a)%mod;
        b >>= 1, a = (a*a)%mod;
    }
    return result;
}

ll super_rand(ll n) // Random number from set [0,n-1]
{
    uniform_int_distribution<ll> uid(0, n - 1);
    return uid(rng);
}



/*

1. Make sure you're taking all the inputs.
2. In case of nested loops, remember to use different variables.
3. If in doubt, do int -> ll
4. Don't fight the question, try solving the next one.
5. ffs (positon of first set bit), clz (leading 0s, max->32), ctz (trailing 0s), popcount (set bits). Don't use any of these on 0;
*/



//  Don't code anything above this //




int main() 
{ 
    BOOST

    int n;
    cin>>n;

    map<int,int> m;
    for(int i=0;i<n;i++)
    {
        int x;
        cin>>x;
        m[x]++;
    }
    if(n%3!=0 || int(m.size())!=3)
        cout<<"NO\n";
    else
    {
        V<int> f;
        V<int> num;
        for(auto i : m)
            f.pb(i.se),num.pb(i.fi);
        if(f[0]==f[1] && f[0]==f[2])
            if(num[0]^num[1]^num[2] == 0)
                return cout<<"YES\n",0;
        cout<<"NO\n";
    }
    return 0;

}

