n = int(input())
a_lists = list(input().split())

for i in range(int(n)):
    if i == 0:
        if int(a_lists[i]) != int(a_lists[i+1]) ^ int(a_lists[n-1]):
            print("No")
            exit()
    elif i == n-1:
        if int(a_lists[i]) != int(a_lists[i-1]) ^ int(a_lists[0]):
            print("No")
            exit()
    else:
        if int(a_lists[i]) != int(a_lists[i+1]) ^ int(a_lists[i-1]):
            print("No")
            exit()

print("Yes")
