#Xor circle
n=int(input())
lists=list(map(int,input().split()))
import collections
d=dict(collections.Counter(lists))
if len(d)==3:
    sub=[]
    for some in d.values():
        sub.append(some)
    sub=sorted(sub)
    a,b,c=tuple([some for some in d.keys()])
    judge=False
    if a^b^c==0:
        judge=True
    if n%3==0:
        if sub==[n//3,n//3,n//3] and judge:
            print("Yes")
        else:
            print("No")
    elif n%3==1:
        if sub==[n//3,n//3,n-2*n//3] and judge:
            print("Yes")
        else:
            print("No")
    elif n%3==2:
        if sub==[n//3+1,n//3+1,n-n//3*2-2] and judge:
            print("Yes")
        else:
            print("No")
            
    
elif len(d)==2:
    sub=[]
    for some in d.values():
        sub.append(some)
    sub=sorted(sub) 
    if n%3==0:
        if sub==[n//3*2,n//3]:
            print("Yes")
        else:
            print("No")
    elif n%3==1:
        if sub==[n//3*2,n-n//3*2] or sub==[n//3*2+1,n-1-2*n//3]:
            print("Yes")
        else:
            print("No")
    elif n%3==2:
        if sub==[n//3*2+1,n//3+1] or sub==[n//3*2+2,n//3]:
            print("Yes")
        else:
            print("No")
    
    
elif len(d)==1:
    print("Yes")

else:
    print("No")
        