n=int(input())
mod=10**9+7
l=list(map(int,input().split()))
d=len(str(bin(max(l))))-2
ll=[[0,0] for i in range(d)]
ans=0
for i in l:
  f=bin(i)[2:]
  for v in range(len(f)):
    ll[v][int(f[v])]+=1
for i,(a,s) in enumerate(ll):
  ans+=pow(2,i,mod)*a*s%mod
  ans%=mod
print(ans)
