n = int(input())
a = list(map(lambda x: int(x), input().split()))
res = 0
MOD = 1e9 + 7
for i in range(60):
    w = 1 << i
    c1 = 0
    c0 = 0
    for j in a:
        t = w & j
        if t == 0:
            c0 += 1
        else:
            c1 += 1
    res = (res + w * c0 % MOD * c1 % MOD) % MOD
print (res)