N = int(input())
A = list(map(int, input().split()))

M = 10**9+7
ans = 0

def f(a, b, c):
    return a%M*b%M*c%M

for i in range(60):
    count = 0
    b = 1<<i
    for a in A:
        if (a&b) != 0:
            count += 1
    ans = (ans+f(count, N-count, b))%M

print(ans)
