num_hat = int(input())

numbers = [int(i) for i in input().split(' ')]
numbers.append(numbers[0])
numbers.append(numbers[1])

for i in range(1, num_hat+1+1):
    if numbers[i] != numbers[i-1] ^ numbers[i+1]:
        print("No")
        exit(0)

else:
    print("Yes")

exit(0)
