N=int(input())
a=list(map(int, input().split()))
Flag=True

if bin(a[N-2] ^ a[0]) == bin(a[N-1]):
    if bin(a[N-1] ^ a[1]) == bin(a[0]):
        for i in range(0,N-2):
            if Flag==True:
                if bin(a[i] ^ a[i+2]) == bin(a[i+1]):
                  pass
                else:        
                  Flag=False                  
        if Flag==True:
            print("Yes")
        else:
            print("No")
    else:
        print("No")    
else:
    print("No")