N=int(input())
a=input().split()
A=[int(b) for b in a]
B=[format(a,'b').zfill(100) for a in A]
mod=pow(10,9)+7
answer=0
for i in range(100):
    zero=0
    one=0
    kotae=1
    for j in B:
        if j[i]=='0':
            zero+=1
        elif j[i]=='1':
            one+=1
    kotae=zero*one
    for _ in range(100-i-1):
        kotae*=2
    answer+=kotae
print(answer%mod)
