local mod = 1000000007
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 box = {0}
local mul = {1}
for i = 2, 61 do
  box[i] = 0
  mul[i] = bmul(mul[i - 1], 2)
end
local ret = 0
for i = 1, n do
  local a = io.read("*n")
  for j = 1, 61 do
    local p = a % 2
    if p == 1 then
      ret = badd(ret, bmul(mul[j], i - 1 - box[j]))
    else
      ret = badd(ret, bmul(mul[j], box[j]))
    end
    box[j] = box[j] + p
    a = a // 2
  end
end
print(ret)
