mod = 10**9 + 7

def pow_k(x, n):
    """
    O(log n)
    """
    if n == 0:
        return 1
    K = 1
    while n > 1:
        if n % 2 != 0:
            K = (K * x) % mod 
            x = (x ** 2) % mod
            n = (n - 1) // 2
        else:
            x = (x ** 2) % mod
            n = n // 2

    return (K * x) % mod # 指数を割り続け n が 1 に至ったら終了

N = int(input())
A = list(map(int,input().split()))
cnt_1 = [0]*61
for i in range(N):
    A_tmp = A[i]
    for j in range(61):
        if (A_tmp >> j & 1):
            cnt_1[j] += 1
ans = 0
for i in range(61):
    ans += (cnt_1[i]*(N - cnt_1[i]) * pow_k(2,i)) % mod
print(ans % mod)