import collections
import itertools


N=int(input())
A=list(map(int,input().split()))
data=collections.Counter(A)

def binbin(a,b,c):
    data2={"x":bin(a)[3:],"y":bin(b)[3:],"z":bin(c)[3:]}
    length=len(bin(a)[3:])
    ite=itertools.permutations("xyz")
    for x,y,z in ite:
        data=[]
        for i in range(length):
            if not (int(data2[x][i]) + int(data2[y][i]))%2 == int(data2[z][i]):
                return(0)
    return(1)


if data[0]==N:
    print("Yes")
elif N%3==0:
    mc=data.most_common()
    if data[0] == N//3 and len(data)==2:
        print("Yes")
    elif len(data)==3 and binbin(mc[0][0],mc[1][0],mc[2][0]) and mc[0][1]==mc[1][1]==mc[2][1]:
        print("Yes")
    else:
        print("No")
else:
    print("No")
