def Xor (x,y):
    return ((x and y) or (not x and not y))

def xor (x,y):
    n=len(x)
    ans=[Xor(x[i],y[i]) for i in range(n)]
    return ans

def bina (x):
    da=[True for i in range(32)]
    for i in da:
        i=bool(x%2)
        i/=2
    return da

def check(x,y,z):
    return xor(bina(x),bina(y))==bina(z)


n=int(input())
da=list(map(int,input().split()))
co=set(da)
m=len(co)
ju=False
if m==1:
    if da[0]==0:
        ju=True
elif m==2:
    gg={}
    if n%3==0:
        for i in co:
            gg[i]=0
        for i in da:
            gg[i]+=1
        hoge=[0,0]
        for (i,j) in zip(hoge,gg.values()):
            i=j
        if da[1]==da[0]*2:
            ju=check(da[1],da[1],da[0])
        elif da[0]==da[1]*2:
            ju=check(da[0],da[0],da[1])
elif m==3:
    gg={}
    if n%3==0:
        for i in co:
            gg[i]=0
        for i in da:
            gg[i]+=1
        hoge=[0,0,0]
        for (i,j) in zip(range(3),gg.values()):
            hoge[i]=j
        if hoge[0]==n/3 and hoge[1]==n/3 and hoge[2]==n/3:
            ju=check(da[0],da[1],da[2])
if ju:
    print('Yes')
else:
    print('No')
