def solve():
    N = int(input())
    a = [int(s) for s in input().split() if s]
    flag = True
    for i in range(N):
        first = (i-1)%N
        second = (i+1)%N
        if a[i] != a[first]^a[second]:
            flag = False
    print('Yes' if flag else 'No')

solve()