def xor_hat(n, *lis):
    for i in range(n):
        if(lis[i] != lis[(i+1)%n] ^ lis[i-1]):
            return print("No")
    return print("Yes")

n = int(input())
camel = [int(i) for i in input().split()]
xor_hat(n, *camel)