N = int(input())
A = list(map(int,input().split()))
num0 = 0
num1 = 0
ans = 0
for i in range(61):
    for j in A:
        if(j%(2**(i+1))>=2**i):
            num1 +=1
        else:
            num0 +=1
    ans += num0*num1*(2**i)
    num0,num1 = 0,0
print(ans%(10**9+7))