local mod = 1000000007
local mfl = math.floor
local function badd(x, y) return (x + y) % mod end
local function bmul(x, y) return (x * y) % mod end

local n = io.read("*n")
local lim = 60
local box = {}
for i = 1, lim do
  box[i] = 0
end
local mulcnt = {}
for i = 1, lim do
  mulcnt[i] = 0
end
for i = 1, n do
  local a = io.read("*n")
  for j = 1, lim do
    local p = a % 2
    if p == 1 then
      mulcnt[j] = mulcnt[j] + i - 1 - box[j]
      box[j] = box[j] + 1
    else
      mulcnt[j] = mulcnt[j] + box[j]
    end
    a = a // 2
  end
end
local ret = 0
local mul = 1
for i = 1, lim do
  ret = badd(ret, bmul(mul, mulcnt[i]))
  mul = (mul * 2) % mod
end
print(ret)
