n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7
max_len = len(format(max(a), "b"))
a = [format(a[i], "b") for i in range(n)]
b = [0 for _ in range(max_len)]

for i in range(n):
    for j in range(1, 1+len(a[i])):
        if int(a[i][-j]):
            b[j-1] += 1

result = 0
for i in range(max_len):
    r = b[i]*(n-b[i])%mod
    r = (r*2**i) %mod
    result += r
print(result%mod) 