N = int(input())
nums = [int(i) for i in input().split()]
ans = "Yes"
for i in range(len(nums)):
    if i == 0:
        if nums[N-1]^nums[1]==nums[0]:
            continue
        else:
            ans = "No"
    elif i == N-1:
        if nums[N-2]^nums[0]==nums[N-1]:
            continue
        else:
            ans = "No"
    else:
        if nums[i-1]^nums[i+1]==nums[i]:
            continue
        else:
            ans = "No"

print(ans)