mod = 10**9+7

N = int(raw_input())

num0 = [0]*61
num1 = [0]*61

A = map(int, raw_input().split())

for i in range(N):
    ai = A[i]
    for j in range(61):
        if ai & 1 << j:
            num1[j] += 1
        else:
            num0[j] += 1
ans = 0

for i in range(61):
    ans = ans + num0[i]*num1[i]*2**i % mod

print int(ans)

