local function getxor(x, y)
  local ret = 0
  local mul = 1
  while 0 < x or 0 < y do
    if (x % 2) + (y % 2) == 1 then
      ret = ret + mul
    end
    x, y, mul = x // 2, y // 2, mul * 2
  end
  return ret
end

local n = io.read("*n")
local a = {}
local allzero = true
for i = 1, n do
  a[i] = io.read("*n")
  if a[i] ~= 0 then allzero = false end
end
if allzero then
  print("Yes")
elseif n % 3 ~= 0 then
  print("No")
else
  local x, y, z = a[1], a[2], a[3]
  if getxor(x, y) ~= z then
    print("No")
  else
    local f = true
    for i = 2, n // 3 do
      if a[i * 3 - 2] ~= a[1] or a[i * 3 - 1] ~= a[2] or a[i * 3] ~= a[3] then
        f = false
        break
      end
    end
    print(f and "Yes" or "No")
  end
end
