MOD = 10**9+7
N = int(input())
A = list(map(int, input().split()))
 
ans = 0
twopow = 1
for n in range(60):
    one = 0
    for i in range(N):
        one += A[i] & 1
        A[i] >>= 1
    zero = N - one
    ans = (ans + (one * zero) * twopow) % MOD
    twopow = twopow << 1 % MOD

print(ans)