N = int(input())
a = list(map(int, input().split()))
all_xor = 0
for i in range(N):
    all_xor = a[i] ^ all_xor
    if i == 0:
        if a[N-1] == a[1]:
            if a[0] != 0:
                print("No")
                exit()
                break
        continue
    if i == N - 1:
        if a[N-2] == a[0]:
            if a[N-1] != 0:
                print("No")
                exit()
                break
        continue
    if a[i - 1] == a[i + 1]:
        if a[i] == 0:
            print("No")
            exit()


if all_xor == 0:
    print("Yes")
else:
    print("No")
