def count(num_lst):
    count = [0]*60
    for num in num_lst:
        for i in range(60):
            if num & (1<<i):
                count[i] += 1
    return count

n = int(input())
num_list = list(map(int,input().split()))
mod = 10**9 + 7

count = count(num_list)
ans = 0
for i in range(60):
    ans += (2**i * count[i] * (n - count[i])) % mod
    ans %= mod
print(ans)