local bls, brs = bit.lshift, bit.rshift local bxor = bit.bxor local function grayCode(x) return bxor(x, brs(x, 1)) end local function grayWalk(size, add_func, rm_func, work_func) local prv = 0 local total = bls(1, size) - 1 local bpos = {} for i = 1, size do bpos[bls(1, i - 1)] = i end -- work_func() for i = 1, total do local v = grayCode(i) if prv < v then prv, v = v, v - prv add_func(bpos[v]) else prv, v = v, prv - v rm_func(bpos[v]) end work_func() end end local n = io.read("*n") local a = {} local v = 0 for i = 1, n do a[i] = io.read("*n") v = bxor(v, a[i]) end if 0 < v then print("No") os.exit() end for i = 1, n do if a[i] == 0 then print("Yes") os.exit() end end if n == 2 then print("No") os.exit() end local map = {} local t = {} for i = 1, n do if map[a[i]] then print("Yes") os.exit() end map[a[i]] = true table.insert(t, a[i]) end n = #t if 16 < n then print("Yes") os.exit() end local v = 0 local c = 0 local function add_func(idx) v = bxor(v, t[idx]) c = c + 1 end local function rm_func(idx) v = bxor(v, t[idx]) c = c - 1 end local function work_func() if c < n and v == 0 then print("Yes") os.exit() end end grayWalk(n, add_func, rm_func, work_func) print("No")