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