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

def p(x):
    tmp = (bin(x)[2:])
    l = len(tmp)
    ans = '0'*(70-l) + tmp
    return ans


n = int(input())
a = list(map(int, input().split()))
count = np.array([0] * 70)
for i in range(n):
    tmp = np.array(list(p(a[i])))
    #print(tmp)
    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)

