n = int(input())
a = [int(i) for i in input().split()]

mod = 10 ** 9 + 7

cnt = [0] * 60
for i in range(n):
    for j in range(60):
        cnt[j] += a[i] % 2
        a[i] = a[i] // 2

ans = 0
for i in range(60):
    ans = (ans + (2 ** i) * cnt[i] * (n - cnt[i])) % mod

print(ans)
