n = int(input())
a = list(map(int,input().split()))
g = []
ans = 0
for j in range(60):
    d = 0
    for i in range(n):
        if a[i]&(2**j) == 2**j:
            d += 1
    g.append(d)
for i in range(60):
    ans += g[i]*(n-g[i])*(pow(2,i,10**9+7))
    ans = ans % (10**9+7)
print(ans%(10**9+7))