MOD=10**9+7
cnt=0; sum=0; prev=nil; can=true; h=Hash(Int32,Int32).new(0)
def putsend(s) puts s; exit end
########### ( ˘ω˘ )ｽﾔｧ… ###########
n=gets.not_nil!.to_i
a=gets.not_nil!.chomp.split.map(&.to_i)
n.times do |i|
  b=a[i].to_s(2).reverse
  l=b.size
  l.times do |j|
    if b[j]=='1'
      h[j]+=1
    end
  end
end
l=h.keys.max
putsend 0 if l==0

0.upto(l) do |i|
  next if h[i]==0
  cnt+=(((2**i)%MOD)*h[i]*(n-h[i]))
  cnt%=MOD
end
puts cnt%MOD