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

bit = [0] * 50

for a in al:
    for i in range(50):
        bit[i] += (a % 2)
        bit[i] %= 10**9 + 7
        a = a // 2

ans = 0
p = 1
for i in range(50):
    ans += bit[i] * (n - bit[i]) * p
    ans %= 10**9 + 7
    p *= 2

print(ans)