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]

cnt = []
for i in range(61):
    cnt.append(K[i] * (N - K[i]))
cnt.reverse()

ans = 0
for i in range(61):
    ans += (2 ** i) * cnt[i] % MOD

print(ans % MOD)