#%%
inf = 10**9 + 7
import numpy as np

n = int(input())
a = list(map(int, input().split()))
count = np.array([0] * 70)
for i in range(n):
    tmp = np.array(list(map(int, (bin(a[i])[2:].zfill(70)))))
    count[tmp==1] += 1


ans = 0
for i in range(70):
    k = 2 ** (69 - i)
    k %= inf
    x = count[i] % inf
    y = (n - x) % inf
    ans += (x * y * k) % inf
    ans %= inf

ans %= inf
print(ans)


# %%
