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

flag = True

for i in range(n):
    if line[i] != line[(i-1)%n] ^ line[(i+1)%n]:
        flag = False

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