n=int(input())
a=list(map(int,input().split()))
INF=10**9+7
md=len(bin(max(a)))-2
ans=0
for i in range(md):
  cnt1=sum([1 for j in a if (j>>i)&1])
  ans+=cnt1*(n-cnt1)*(1<<i)
  ans%=INF
print(ans%INF)
