N = int(input())
aaa = list(map(int, input().split()))
zero = [0] * 61
one = [0] * 61
for a in aaa:
    for i in range(61):
        if a & (1<<i):
            one[i] += 1
        else:
            zero[i] += 1
ans = 0
MOD = 1_000_000_007
for i, o, l in zip(range(61), zero, one):
    ans += 2**i * o * l
    ans %= MOD
print(ans)
