N = int(raw_input())
A = map(int, raw_input().split())
A = map(lambda x: format(x, '060b'), A)
MOD = 10**9 + 7

count = dict()
for i in range(60):
    zeros = len([a[i] for a in A if a[i] == '0'])
    ones = N - zeros
    count[i] = zeros*ones

ans = 0
for i, v in count.items():
    ans = (ans + count[i]*((1<<(59-i)) % MOD)) % MOD

print ans
