import math
n=int(input())
a=list(map(int,input().split()))
m=math.ceil(math.log(max(1,max(a)),2))

ans=0
for i in range(m):
  sum1=sum((a[j]>>i)&1 for j in range(n))
  sum0=n-sum1
  ans+=2**i*sum1*sum0

print(ans%(10**9+7))