n = int(input())
a = list(map(int, input().split()))
b = []
for i in range(n):
    c = []
    for j in range(60):
        if a[i] % 2**(j+1) == 0:
            c.append(0)
        else:
            c.append(1)
            a[i] -= 2**j
    b.append(c)

ans = 0

for i in range(60):
    c0 = 0
    c1 = 0
    for j in range(n):
        if b[j][i] == 0:
            c0 += 1
        else:
            c1 += 1
    ans += 2 ** i * c0 * c1
    ans %= 10**9 + 7

print(ans)