n=int(input())
a=list(map(int,input().split()))
mod=10**9+7
cnt=[]
for i in range(60):
	p=0
	for j in range(n):
		if a[j]%2==1:
			p+=1
		a[j]//=2
	cnt.append(p)
ans=0
for i in range(60):
	ans+=(n-cnt[i])*cnt[i]*(2**i)
	ans%=10**9+7
print(ans)