import numpy as np
n = int(input())
N = 60

a = map(int, input().split())
nums = []
for aa in a:
    b = list(reversed(list(map(int, format(aa, "060b")))))
    nums.append(b)
nums = np.array(nums)
res = 0
MOD = int(1e9+7)
k = np.full(N, n*(n-1)/2)
n1 = nums.sum(0)
n0 = n-nums.sum(0)
k -= n1*(n1-1)//2
k -= n0*(n0-1)//2
k *= (2**np.arange(N)) % MOD

res = 0
for kk in k:
    res += kk
    res %= MOD


print(int(res))
