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

for i in range(60):
    count0 = 0
    count1 = 0
    for j in range(N):
        a = A[j]>>i & 1
        if a==0:
            count0 += 1
        else:
            count1 += 1
    tmp = 2**i
    n = count0 * count1
    tmp = tmp * n
    ans += tmp
    ans = ans % MOD
print(ans)