mod = 10**9+7
from collections import defaultdict
N = int(input())
A = list(map(int,input().split()))
d = defaultdict(lambda:0)
ans = 0
for a in A:
    a = bin(a)[2:]
    for i in range(len(a)):
        if a[-i-1]=='1':
            d[i] += 1

for a in A:
    a = (60-len(bin(a))+2)*'0'+bin(a)[2:]
    for i in d:
        if a[-i-1]=='0':
            ans += pow(2,i,mod)*d[i]
        else:
            ans += pow(2,i,mod)*(N-d[i])

ans *= pow(2,mod-2,mod)
ans %= mod
print(ans)