local ffi = require("ffi")
local C = ffi.C
ffi.cdef[[
long long atoll(const char*);
]]

local function lltonumber(str)
  return C.atoll(str)
end

local n = io.read("*n", "*l")
local s = io.read()
local t = {}
for i = 1, 60 do
  t[i] = {}
end
do
  local j = 0
  for w in s:gmatch("%d+") do
    j = j + 1
    local v = lltonumber(w)
    for k = 1, 60 do
      t[k][j] = v % 2LL == 1LL
      v = v / 2LL
    end
  end
end
local flag = {}
for i = 1, 60 do
  flag[i] = 1
end
local pow2 = {}
pow2[1] = 1LL
for i = 2, 61 do
  pow2[i] = pow2[i - 1] * 2LL
end
local ret = 0LL

local tasks = {}
for ib = 60, 1, -1 do
  local right = false
  local cnt = 0
  local tib = t[ib]
  for i = 1, n do
    if tib[i] then
      cnt = cnt + 1
      right = i
      tasks[cnt] = i
    end
  end
  if flag[ib] == 1 then
    if cnt == 0 then
      -- nothing
    elseif cnt % 2 == 1 then
      ret = ret + pow2[ib]
    else
      ret = ret + pow2[ib + 1]
      for ic = ib - 1, 1, -1 do
        if t[ic][right] then
          flag[ic] = 1 - flag[ic]
          for i = 1, cnt do
            local z = tasks[i]
            t[ic][z] = not t[ic][z]
          end
        end
      end
    end
  else--flag[ib] == 0
    if cnt == 0 then
      ret = ret + pow2[ib + 1]
      -- nothing
    elseif cnt % 2 == 1 then
      ret = ret + pow2[ib]
    else
      ret = ret + pow2[ib + 1]
      for ic = ib - 1, 1, -1 do
        if t[ic][right] then
          for i = 1, cnt do
            local z = tasks[i]
            t[ic][z] = not t[ic][z]
          end
        end
      end
    end
  end
end
ret = tostring(ret):gsub("LL", "")
print(ret)
