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:
  for j,v in enumerate(bin(i)[2:].zfill(d)):
    ll[d-j-1][int(v)]+=1
for i,(a,s) in enumerate(ll):
  ans+=(2**i%mod)*a*s%mod
  ans%=mod
print(ans)