n = int(input())
a = list(map(int,input().split()))
mod = 10**9+7
ans = 0
for i in range(60):
    count = 0
    for j in a:
        if j >> i & 1:
            count += 1
    ans += count * (n-count) * 2** i
print(ans % mod)    