#include <bits/stdc++.h>
using namespace std;
//Define many functions and words!!
//The functions I have defined start with a capital letter.

//C++ words.
typedef long long ll;
typedef vector<ll> vl;
typedef vector<double> vd;
typedef vector<vl> matrix;//A(n, vl(m)); n*m行列
typedef vector<string> vs;
typedef pair<ll,ll> pl;
typedef vector<pl> vp;
typedef pair<double,double> pd;
typedef vector<pd> vpd;
typedef vector<bool> vb;
typedef map<ll,ll> mapl;
#define nl "\n"s
#define rep(i,n) for(ll i=0LL; i<(n); i++)
#define INF ((1LL<<62)-(1LL<<31))
#define MOD 1'000'000'007 //998'244'353
#define PB push_back
#define MP make_pair
#define F first
#define S second
#define All(V) V.begin(),V.end()
#define Sortup(V) sort(All(V))
#define Sortdown(V) sort(V.rbegin(), V.rend())
#define Atleast(key, V) lower_bound(All(V), key)
#define Largerthan(key, V) upper_bound(All(V), key)

#define endYes do{cout << "Yes" << nl; return 0;}while(0)
#define endYES do{cout << "YES" << nl; return 0;}while(0)
#define endNo  do{cout << "No" << nl; return 0;}while(0)
#define endNO  do{cout << "NO" << nl; return 0;}while(0)


//Mathmatical functions.
template<class T>bool Chmax(T &a, const T &b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool Chmin(T &a, const T &b){if(b<a){a=b;return 1;}return 0;}
ll Lpow(ll e,ll x){ll res=1LL;while(x){if(x&1)res*=e;e*=e;x/=2;}return res;}
ll LpowMOD(ll e,ll x){ll res=1LL;while(x){if(x&1)res*=e;e*=e;x/=2;res%=MOD;e%=MOD;}return res;}
void CumuSum(vl &A){rep(i,A.size())if(i)A[i]+=A[i-1];}
bool Bit(ll subset, ll Rsift){ return ((subset)>>(Rsift))&1; }
ll Gcd(ll a,ll b){ return b?Gcd(b,a%b):abs(a); }
ll Lcm(ll A,ll B){ return A/Gcd(A,B)*B; }
template<class T>double Dist(T x,T y,T X,T Y){return sqrt(pow(x-X,2.0)+pow(y-Y,2.0));}

//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
// solution comes here

//解説AC

int main() {
    ios::sync_with_stdio(0); cin.tie(0);

    ll N;
    cin >> N;
    vl a(N);
    rep(i, N) cin >> a[i];

    mapl m;
    rep(i, N) m[a[i]]++;

    if(m.count(0)  and  m[0] == N) endYes;

    if(m.count(0)  and  m[0]*3 == N  and  m.size()==2  and  N%3==0) endYes;

    if(m.size() == 3){
        vl t(3);
        int i=0;
        for(auto x:m){
            if( !(x.S*3 == N)) endNo;
            t[i++] = x.F;
        }

        if(t[0] ^ t[1] ^ t[2] == 0) endYes;
    }

    endNo;
}