# D - Xor Sum 4
mod = 1000000007
N = int(input())
Alist = list(map(int, input().split()))
ans = 0
for i in range(60):
    x = 0;
    for j in range(N):
        if Alist[j]>>i&1:
            x += 1
    now = x * (N - x) % mod
    for j in range(i):
        now = now * 2 % mod  # オーバーフロー対策
    ans += now
    ans %= mod
    
print(ans)