#%%
inf = 10**9 + 7

n = int(input())
a = list(map(int, input().split()))
count = [0] * 70
for i in range(n):
    tmp = list(str(bin(a[i])[2:]))[::-1]
    #print(tmp)
    for j in range(len(tmp)):
        if tmp[j] == '1':
            k = 69 - j
            count[k] += 1

#print(count)

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)



# %%
