import itertools

mod = 10 ** 9 + 7
n = int(input())
a = list(map(int, input().split()))
l = [0 for i in range(len(str(bin(max(a)))) - 2)]
a = [bin(i)[2:] for i in a]

for i in a:
    for j, k in enumerate(i[::-1]):
        if k == "1":
            l[j] += 1
ans = 0
for i, j in enumerate(l):
    ans = (ans + (j * (n - j)) * (2 ** i)) % mod
print(ans)