N = int(input())
a_list = list(map(int, input().split()))

from collections import defaultdict

cnt = defaultdict(int)

for i in range(N):
    for j in range(61):
        if a_list[i] & (1 << j):
            cnt[j] += 1


ans = 0
mod = 10 ** 9 + 7

for i in range(61):
    ans += cnt[i] * (N - cnt[i]) * (1 << i)
    ans %= mod
print(ans)
