n = int(input())
xs = [int(x) for x in input().split()]
M = 10**9 + 7
r = 0
for i in range(61):
    k = 0
    for x in xs:
        k += (x >> i) % 2
    r = (r + ((n-k) * k % M) * pow(2, i) )% M

print(r)
