import math
import numpy as np
n = int(input())
a = list(map(int, input().split()))

dgt = int(math.sqrt(max(a)))+1
dp = np.zeros(dgt)

for i in range(n):
    k = np.array(list( bin(a[i])[2:].zfill(dgt)), dtype=int)
    dp += k

res = 0
for i in range(dgt):
    if dp[-i-1] > 0:
        res += 2**i*int(dp[-i-1])*int(n-dp[-i-1]) % (10**9+7)
print(res)