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 str = io.read() local a = {} for w in str:gmatch("%d+") do table.insert(a, lltonumber(w)) end local digmax = 61 local ret = 1LL local t = {} for i = 1, digmax do t[i] = {} for j = 1, n do t[i][j] = a[j] % 2LL == 1LL a[j] = a[j] / 2LL end end local rem = n for j = 1, digmax do local tgt = 0 local tj = t[j] for i = 1, rem do if tj[i] then ret = ret + ret tgt = i break end end if 0 < tgt then for i = tgt + 1, rem do if t[j][i] then for k = j + 1, digmax do if t[k][tgt] then t[k][i] = not t[k][i] end end end end if tgt < rem then for k = j + 1, digmax do t[k][tgt] = t[k][rem] end end rem = rem - 1 end end ret = tostring(ret):gsub("LL", "") print(ret) -- print(os.clock())