def resolve():
    n = int(input())
    aa = list(map(int, input().split()))

    flg = bin(aa[0]) == bin(aa[len(aa)-1] ^ aa[1]) and bin(aa[len(aa)-1]) == bin(aa[len(aa)-2] ^ aa[0])

    for a1,a2,a3 in zip(aa,aa[1:],aa[2:]):
        if bin(a2) != bin(a1 ^ a3):
            flg = False
            break

    print('Yes' if flg else 'No')
    
resolve()