n=int(input())
a=[int(i) for i in input().split()]
amax=max(a)
m=len( bin(amax)[2:] )
bin_a = [bin(aa)[2:].zfill(m) for aa in a]

ans=0
mod=10**9+7
for i in range(m):
    sum0 = sum( bi[-1-i]=="0" for bi in bin_a )
    sum1 = sum( bi[-1-i]=="1" for bi in bin_a )
    ans += sum0*sum1*2**i % mod
print(ans%mod)