fun main(args: Array<String>) = yorukatsu15d()

fun yorukatsu15d() {
    val n = readLine()!!.toInt()
    val aList = readLine()!!.split(' ').map { it.toLong() }.toLongArray()

    var answer = 0L

    for (i in 0..62) {
        var zero = 0L
        var one = 0L
        for (a in aList) if ((a and 1) == 0L) zero++ else one++

        answer += (((1L shl i) % MOD * one) % MOD * zero) % MOD
        answer %= MOD

        for (j in aList.indices) aList[j] = aList[j] shr 1
    }

    println(answer)
}

private const val MOD = (1e9 + 7).toLong()
