N =int(input())
A = list(map(int, input().split()))
ans = 0
mod = 10**9+7
b = [0]*60
for i in range(N):
    for j in range(1,61):
        if len(bin(A[i])) -1  <= j:
            break
        else:
            b[-j] += int(bin(A[i])[-j])
for i in range(1,61):
    ans += (b[-i] * (N - b[-i])*(2**(i-1)))%mod
print(ans%mod)
