'''import math
def count_total(s1,s2):
    f = 0
    s = 0
    cnt = 0
    while s2>0:
        #print(bin(s1).replace("0b",""),bin(s2).replace("0b",""))
        #print(s1,s2)
        f = s1 ^ s2
        s = s1 & s2
        s1 = f
        s2 = s<<1
        cnt+=1
    return cnt
t = int(input())
for _ in range(0,t):
    s1 = int(input(),2)
    s2 = int(input(),2)
    if(len(str(s2))<=500): 
        print(count_total(s1,s2))
    else:
        print(-1)
'''

n=int(input())
a=list(map(int,input().split(' ')))
sum=0
for i in range(0,62):
    z=0
    o=0
    cr=0
    for j in range(0,n):
        if(a[j]%2==0):
            z+=1
        else:
            o+=1
        a[j]//=2
    
    cr = o*z*(1<<i)
    sum+=cr
    if(sum>1000000007):
        sum%=1000000007
print(sum%1000000007)