input()
a=list(map(int,input().split()))
b=list(set(a))
if b[0]!=0:
    if len(a)%3==0:
        if len(b)==3:
            b=[format(i, '032b') for i in b]
            b=[(int(b[0][i])+int(b[1][i]))%2==int(b[2][i]) for i in range(32)]
            if False in b:
                print("No")
            else:
                print("Yes")
        else:
            print("No")
    else:
        print("No")
else:
    if len(a)%(len(b))==0:
        print("Yes")
    else:
        print("No")