n = int(input())
a = list(map(int, input().split()))
L = len(format(max(a), 'b'))
x = [[0 for j in range(60)] for i in range(2)]
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[int(s)][j] += 1
for i in range(60):
    x0 = x[0][i]
    x1 = x[1][i]
    y = x0 * x1
    ans += y * 2 ** i % MOD
    ans %= MOD
print(ans)
