n =int(input())
al = list(map(int,input().split()))

res = 0
bits = [[0]*2 for _ in range(60)]
for a in al:
    for i in range(60):
        bits[i][int(bin(a >> i)[-1])] += 1

res = 0

for i in range(60):
    res += bits[i][0] * bits[i][1]  * (2 ** i)

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