import sequtils,strutils,math
const M=10^9+7
let n=stdin.readLine.parseInt
var b=newSeq[int] 61
for a in stdin.readLine.split.map parseInt:
  for i in 0..60:
    if(2^i and a)>0:
      b[i]+=1
var a=0
for i,x in b:
  a=(a+x*(n-x)*2^i)mod M
echo a