def read():
    N = int(input().strip())
    A = list(map(int, input().strip().split()))
    return N, A


def solve(N, A, L=60, MOD=10**9+7):
    # j桁目のビットが1であるものの数を記憶
    count_zeros = [0 for j in range(L+1)]
    count_ones = [0 for j in range(L+1)]
    for i in range(N):
        for j in range(L):
            count_ones[j] = count_ones[j] + ((A[i] >> j) & 1)
            count_zeros[j] = N - count_ones[j]
    # A[i] と A[j] (i<j) のxorをとる
    modsum = 0
    for j in range(L):
        # MODは一度にとる
        modsum +=  (1<<j) * count_zeros[j] * count_ones[j]
        modsum %= MOD
    return modsum


if __name__ == '__main__':
    inputs = read()
    print("%d" % solve(*inputs))
