n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
point = 0
kai = [2**i%mod for i in range(61)]
for i in range(61):
    now = sum(1 for j in a if(j >> i)&1)
    point += now*(n-now)*kai[i]
    point %= mod
print(point)