n = int(input())
a = list(map(int, input().split()))
a.append(a[0])
a.insert(0, a[-2])

ans = True
for i in range(1, n+1):
    if a[i-1] ^ a[i+1] != a[i]:
        ans = False
if ans:
    print("Yes")
else:
    print("No")

