n = int(input())

l = [int(i) for i in input().split()]

res = 0

for i in range(64):
    zc = 0
    oc = 0
    idsum = 0
    for j in range(0, n):
        if (l[j] % 2 == 0):
            zc += 1
        else:
            oc += 1
        l[j] = int(l[j] / 2)
    
    idsum = oc * zc * (1 << i)
    
    res += idsum

print(res % (10**9 + 7))
