ii = lambda : int(input())
mi = lambda : map(int,input().split())
li = lambda : list(map(int,input().split()))

n = ii()
alis = li()
import numpy as np
alis = np.array(alis,dtype=np.int64)
b = [0] * 61
count = 0
while True:
    if np.all(alis== 0):
        break
    c = (alis % 2 == 0)
    b[count] = sum(c)
    count += 1
    alis //= 2
mod = 10 ** 9 + 7
ans = 0
for i in range(61):
    tmp = (1<<i) % mod
    k = (b[i] * (n-b[i]))  % mod
    k = k*tmp % mod
    ans += k
    ans %= mod
print(ans)

