#include<bits/stdc++.h>
#define int long long
using namespace std;
int ans;
void func(int arr[][2],int index,int n,int k,vector<int>temp)
{
    if(index==3){
        // cout<<"Array\n";
        // for(auto x:temp)
        //     cout<<x;
        //     cout<<"\n";
        vector<pair<int,int>>p{{1,2},{0,2},{0,1}};
        for(int i=0;i<3;i++){
            int l=p[i].first,r=p[i].second;
            // cout<<l<<" "<<r<<"\n";
            // cout<<temp[l]<<" "<<temp[r]<<" "<<temp[i]<<"\n";
            if((temp[l]^temp[r])!=temp[i]){
                return ;
            }
        }
        for(int i=3;i<n;i++){
            temp.push_back(temp[i%3]);
        }
        // cout<<"Reached\n";
        if(temp[n-1]==temp[0]^temp[n-2]){
            ans=1;
        }
        return ;
    }
    for(int i=0;i<k;i++){
        if(arr[i][1]){
            arr[i][1]--;
            temp.push_back(arr[i][0]);
            func(arr,index+1,n,k,temp);
            temp.pop_back();
            arr[i][1]++;
        }
    }
}
main()
{
    int n;
    cin>>n;
    int a[n];
    int k=0;
    map<int,int>m;
    for(int i=0;i<n;i++){
        int x;
        cin>>x;
        m[x]++;
    }
    if(m.size()>3){
        cout<<"NO\n";
        return 0;
    }
    int arr[3][2],i=0;
    for(auto x:m){
        arr[i][0]=x.first;
        arr[i++][1]=x.second;
    }
    func(arr,0,n,i,{});
    if(ans)
        cout<<"YES\n";
    else
        cout<<"NO\n";
}