n = int(input())
a = list(map(int, input().split()))
L = len(format(max(a), 'b'))
x = [[0 for j in range(2)] for i in range(L)]
ans = 0
MOD = 10 ** 9 + 7
for i in a:
    i_str = list(format(i, '0' + str(L) + 'b'))[::-1]
    for j, s in enumerate(i_str):
        x[j][int(s)] += 1
for i, (x0, x1) in enumerate(x):
    ans += x0 * x1 * 2 ** i % MOD
    ans %= MOD
print(ans)
