N = int(input())
A = list(map(int, input().split()))
ans = 0
mod = 10 ** 9 + 7

for i in range(60):
    x, y = 0, 0    
    for Ai in A:
        if Ai >> i & 1:
            x += 1
    y = N - x
    ans += (x * y) * (2 ** i)
    
print(ans % mod)