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

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

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

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