N = int(input())
A = list(map(int,input().split()))
if N==3:
    if A[0]==A[1]^A[2]:
        print("Yes")
    else:
        print("No")
elif N%3==0:
    flag = 0
    for i in range(3,N):
        if A[i]!=A[i-3]:
            flag = 1
            break
    if flag==0:
        print("Yes")
    else:
        print("No")
else:
    flag = 0
    for i in range(1,N):
        if A[i]!=A[0]:
            flag = 1
            break
    if flag==0:
        print("Yes")
    else:
        print("No")