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

def solve():
    for i in range(1, N-1):
        if A[i-1] ^ A[i+1] != A[i]:
            return False
    if A[N-1] ^ A[1] != A[0]:
        return False
    if A[N-2] ^ A[0] != A[N-1]:
        return False
    return True

print('Yes' if solve() else 'No')
