N = int(input())
A = list(map(int,input().split()))
MOD = 10 ** 9 + 7

K = [0] * 61
for a in A:
    L = list(format(a, 'b').zfill(61))
    M = list(int(s) for s in L)
    for i in range(61):
        K[i] += M[i]

ans = 0
for i in range(61):
    ans += (2 ** (60 - i)) * K[i] * (N - K[i]) % MOD

print(ans % MOD)