N = int(input())
a = [int(v) for v in input().split()]

ans = [b == a ^ c for a, b, c in zip([a[-1]] + a[:-1], a, a[1:] + [a[0]])]
ans += [b == c ^ a for a, b, c in zip([a[-1]] + a[:-1], a, a[1:] + [a[0]])]
if all(ans):
    print("Yes")
else:
    print("No")