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

if a.count(0) == n:
    print("Yes")
elif n % 3 == 0:
    a = [a[-1]] + a + [a[0]]
    for i in range(1, n+1):
        if a[i] != a[i-1] ^ a[i+1]:
            print("No")
            exit()
    print("Yes")
else:
    print("No")