import math
N = int(input())
A = list(map(int, input().split()))
bit = [0] * 60
MOD = 10 ** 9 + 7
for a in A:
    b = a
    i = 0
    while a > 0:
        if a % (2 ** (i+1)) != 0:
            a -= 2 ** i
            bit[i] += 1
        i += 1
answer = 0
for i, b in enumerate(bit):
    answer += (2 ** i) * (b * (N-b))
print(answer % MOD)