n=int(input())
a=list(map(int,input().split()))
if n==3:
    if a[0]^a[1]==a[2]:
        print("Yes")
        exit()
if n%2==1:
    for i in range(n-1):
        if a[i]!=a[i+1]:
            print("No")
            exit()
    print("Yes")
    exit()
for i in range(0,n-2,2):
    if a[i]!=a[i+2]:
        print("No")
        exit()
for i in range(1,n-2,2):
    if a[i]!=a[i+2]:
        print("No")
        exit()
print("Yes")