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 until 60) {
        var zero = 0L
        var one = 0L
        aList.forEach { if ((it and 1) == 0L) zero++ else one++ }

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

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


    println(answer)
}

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