def modpow(a: int, p: int, mod: int) -> int:
    # return a**p (mod MOD) O(log p)
    if p == 0:
        return 1
    if p % 2 == 0:
        half = modpow(a, p//2, mod)
        return half*half % mod
    else:
        return a * modpow(a, p-1, mod) % mod


n = int(input())
a_ls = list(map(int, input().split()))

ret = 0
cnt_1 = [0] * 60

for item in a_ls:
    for i in range(60):
        if len(bin(item)) <= i:
            continue
        elif bin(item)[-1-i] == '1':
            cnt_1[i] += 1

for i in range(60):
    tmp = ((n - cnt_1[i]) * cnt_1[i])
    tmp %= 10 ** 9 + 7
    tmp *= modpow(2, i, 10 ** 9 + 7)
    ret += tmp
    ret %= 10 ** 9 + 7

print(ret)
