n = int(input())
ns = list(map(int, input().split()))
d = [0] * 60
ans = 0
mod = 10 ** 9 + 7
for i in range(60):
    for num in ns:
        d[i] += (num >> i) & 1
    ans = (ans + d[i] * (n-d[i]) * 2 ** i) % mod
print(ans)