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

for i in range(60):
    zeroCnt = 0
    oneCnt = 1
    
    for j in range(n):
        if (a[j] >> i) & 1 == 1:
            oneCnt += 1
        else:
            zeroCnt += 0
    ans += zeroCnt * oneCnt * pow(2, i, mod)
    ans %= mod

pirnt(ans)