import numpy as np
from numba import njit


N = int(input())
A = np.array(list(map(int, input().split())), dtype=np.int64)
MOD = 1_000_000_007


@njit("i8(i8,i8[:],i8)")
def solve(N, A, MOD):
    ans = 0
    two_exp = 1
    for i in range(60):
        one_cnt = 0
        for j in range(N):
            one_cnt += A[j] >> i & 1
        ans += one_cnt * (N - one_cnt) * two_exp
        ans %= MOD
        two_exp <<= 1
        two_exp %= MOD
    return ans


print(solve(N, A, MOD))
