import sys
from math import log2,floor
N = int(sys.stdin.readline().rstrip())
A = list(map(int,sys.stdin.readline().split()))
mod = 10**9+7
ans = 0
for i in range(61):
    bits = 0
    for x in A:
        if (x>>i)&1:
            bits += 1
    s = (bits*(N-bits))%mod
    t = (2**i)%mod
    ans = (ans+s*t)%mod
print(ans)