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 ret = 1LL local t = {} for i = 1, n do t[i] = {} local ai = a[i] for j = 1, 61 do t[i][j] = ai % 2LL == 1LL ai = ai / 2LL end end local f = {} for i = 1, 61 do f[i] = false end local rem = n for j = 1, 61 do if f[j] then for i = 1, rem do t[i][j] = not t[i][j] end end local tgt = 0 for i = 1, rem do if t[i][j] then ret = ret + ret tgt = i break end end if 0 < tgt then for k = j, 61 do if t[tgt][k] then f[k] = not f[k] end end if tgt < rem then for k = j + 1, 61 do t[tgt][k], t[rem][k] = t[rem][k], t[tgt][k] end end rem = rem - 1 end end ret = tostring(ret):gsub("LL", "") print(ret) -- print(os.clock())