import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10 ** 7)

n, *a = map(int, read().split())
a = [a[-1]] + a + [a[0]]
for bf, a, af in zip(a, a[1:], a[2:]):
    if bf ^ af != a:
        print('No')
        break
else:
    print('Yes')
