n = int(input())
a = list(map(int, input().split()))

bit = [0] * 60
mod = 10 ** 9 + 7
ans = 0
for i in range(60):
    c = 0
    for j in range(n):
        c += int(a[j] & 1)
        a[j] //= 2
    ans = (ans + c * (n - c) * (2 ** i)) % mod

print(ans)