n=int(input())
a=list(map(int,input().split()))
result=False

def xor(x1,x2):
    return int(bin((x1^x2)),2)

def check(a):
    state=True
    for i in range(1,len(a)-1):
        if(xor(a[i-1],a[i+1])==a[i] and state):
            state=True
        else:
            state=False

    if(xor(a[len(a)-1],a[1])==a[0] and state):
        state= True
    else:
        state=False

    if(xor(a[len(a)-2],a[0])==a[len(a)-1] and state):
        state=True
    else:
        state=False
    return state

for i in range(len(a)):
    for j in range(i,len(a)-1):
        a[j],a[j+1]=a[j+1],a[j]
        if(check(a)):
            result=True
    a[0],a[-1]=a[-1],a[0]


print("YNeos"[1-int(result)::2])