from math import log2,floor
N = int(input())
A = list(map(int,input().split()))
L = max([len(bin(x)) for x in A])
mod = 10**9+7
ans = 0
for i in range(L):
    bits = 0
    for x in A:
        if (x>>i)&1:
            bits += 1
    ans = (ans+(bits*(N-bits)%mod)*((2**i)%mod))%mod
print(ans)