import math 

N=int(input())
l=10**9+7
nums=list(map(int,input().split()))
k=int(math.log2(max(nums)))+1
mat=[0]*k
for each in nums:
    num=(str(bin(each))[2:])[::-1]
    kk=len(num)
    for i in range(kk):
        if num[i]=="1":
            mat[i]+=1

ans=sum([ (N-mat[i])*mat[i]*pow(2,i,l) for i in range(k)])
print(ans%l)