n = int(input())
a = list(map(int, input().split()))
law = 10 ** 9 + 7

bitsum = [0 for _ in range(60)]
for x in a:
    for i in range(60):
        bitsum[i] += bool(x & (1 << i))

ans = 0
for x in a:
    for i in range(60):
        k = bitsum[i]
        if (x & (1 << i)):
            k = n - k
        ans += k << i
        ans %= law
if ans % 2 == 0:
    print(ans // 2)
else:
    print((ans + law) // 2)