N = int(input())
a = list(map(int,input().split()))
judge = True
if N == 0:
    judge = False
else :

    for i in range(N):
        if i == 0:
            if a[0] != a[1]^a[len(a)-1]:
                judge = False
                break
        elif i == len(a)-1:
            if a[len(a)-1] != a[len(a)-2]^a[0]:
                judge = False
                break
        else :
            if a[i] != a[i-1]^a[i+1]:
                judge = False
                break

if judge :
    print('Yes')
else :
    print('No')

    