MOD = 10**9+7

N   = int(input())
A   = list(map(int,input().split()))
A2   = [0]*N
BitNum = [0]*(61)

for i in range(1,61):
    A2 = [0] * N
    for j in range(N):
        A2[j] = A[j] % 2
        A[j] //= 2
    BitNum[i] = sum(A2)

ans = 0
beki = 0
for i in range(1,61):
    x = BitNum[i]
    y = N - x
    ans += (x*y)*(2**beki)
    ans %= MOD
    beki += 1
print(ans)
