n = int(input())
a = [int(x) for x in input().split()]

d0 = [0]*100
d1 = [0]*100
for i in range(n):
    for j in range(61):
        if a[i] & (1<<j):
            d1[j] += 1
        else:
            d0[j] += 1

x = 1
ans = 0
mod = 10**9+7
for i in range(100):
    ans += x * d0[i] * d1[i] %mod
    x = x * 2 % mod
    ans %= mod
print(ans)