n = int(input())
a = [int(_) for _ in input().split()]
const = 10**9 + 7

ans = 0

zero = [0] * 60
one = [0] * 60

for i in range(n):
    for j in range(60):
        if a[i] >> j & 1:
            one[j] += 1
        else:
            zero[j] += 1

ans = 0

for i in range(n):
    j = 0
    while a[i] != 0:
        if a[i] % 2 == 0:
            ans += one[j] * (2**j)
            zero[j] -= 1
        else:
            ans += zero[j] * (2**j)
            one[j] -= 1
        a[i] //= 2
        j += 1
    ans %= const

print(ans)