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