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

for i in range(61):
    cnt = 0
    for j in range(N):
        cnt += A[j] % 2
        A[j] >>= 1
    ans += (2 ** i) * cnt * (N - cnt)

print(ans % MOD)