local n=io.read("n")
local a={}
for i=1,n do
    a[i]=io.read("n")
end

local mod=1000000007
local total=0
local two=1
for i=0,59 do
    local odd,even=0,0
    for j=1,n do
        if a[j]&(1<<i)>0 then
            odd=odd+1
        else
            even=even+1
        end
    end
    local add=(odd*even)%mod*two%mod
    total=(total+add)%mod
    two=(two*2)%mod
end
print(total)