mod = 10 ** 9 + 7

N = int(input())
A = tuple(map(int, input().split()))

ans = 0
for i in range(60):
    cnt = sum((A_i >> i) & 1 for A_i in A)
    ans += (1 << i) * cnt * (N - cnt)

print(ans % mod)