N=int(input())
MOD=10**9+7
A = list(map(lambda s:"{:060b}".format(int(s)), input().split()))
res=0
for i in range(60):
    r = sum([A[j][59-i]=="1" for j in range(N)])
    res += ((r * (N - r)) << i) % MOD
print(res%MOD)