n=int(input())
lists=list(map(int,input().split()))
import collections
d=dict(collections.Counter(lists))
if n%3==0:
    if min(lists)==-1:
        print("Yes")
    else:
        if len(d)==3:
            a,b,c=tuple([some for some in d.keys()])
            x,y,z=tuple([some for some in d.values()])
            if a^b^c==0 and x==y==z==n//3:
                print("Yes")
            else:
                print("No")
        
        
        elif len(d)==2:
            a,b=tuple([some for some in d.keys()])
            x,y=tuple([some for some in d.values()])
            if a!=0 and b!=0:
                print("No")
            else:
                if a==0:
                    if d[a]==n//3 and d[b]==2*n//3:
                        print("Yes")
                    else:
                        print("No")
                if b==0:
                    if d[b]==n//3 and d[a]==2*n//3:
                        print("Yes")
                    else:
                        print("No")
            
        
        elif len(d)==1:
            if lists[0]==0:
                print("Yes")
            else:
                print("No")
            
        else:
            print("No")
            
    
else:
    print("No")