import sys
sys.setrecursionlimit(10 ** 7)
input = sys.stdin.readline

n = int(input())
a = list( map(int, input().split()))

for i in range(n):
    if a[i] != a[(i+3)%n]:
        print('No')
        exit()

if a[0]!=a[1]^a[2] or a[1]!=a[0]^a[2] or a[2]!=a[0]^a[1]:
    print('No')
    exit()

print('Yes')
