N = int(input())
a = list(map(int,input().split()))
ma = max(a)
maketa = len(bin(ma))-2
#print(maketa)
res = 0
dic = {}
for i in range(maketa):
    dic[i] = 0
for j in range(N):
    count = 0
    while a[j] >= 1:
        dic[count] += a[j] % 2
        a[j] = a[j] // 2
        count += 1
for i in range(maketa):
    num = dic[i]
    res += num*(N-num)*(2**(i))
print(res%(10**9+7))
