import sys
input = sys.stdin.readline

#n = int(input())
#l = list(map(int, input().split()))

'''
a=[]
b=[]
for i in range():
    A, B = map(int, input().split())
    a.append(A)   
    b.append(B)'''

n=int(input())
a=list(map(int, input().split()))
l0=[0]*60
l1=[0]*60
for i in range(n):
    b=bin(a[i])[::-1]
    #print(b)
    for j in range(60):
        if j<len(b)-2:
            if b[j]=="0":
                l0[j]+=1
            else:
                l1[j]+=1
        else:
            l0[j]+=1
#print(l0,l1)
ans=0
for i in range(60):
    ans+=l0[i]*l1[i]*(2**i)
    if ans>=10**9+7:
        ans%=(10**9+7)
print(ans)