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

def hat(_):
    for n in range(N):
        if a[n-2] ^ a[n] != a[n-1]:
            return False
        else:
            n += 2
    return True
            
ans = True
for n in range(N):
    ans = hat(n)
    if ans == False:
        break

if ans:
    print("Yes")
else:
    print("No")