fun main(args: Array<String>) {
    val n = readLine()!!.toInt()
    val l = readLine()!!.split(" ").map{it.toInt()}
    var bits = IntArray(61) { i -> 0}.toMutableList()
    var a = 0.0
    l.forEach{
        var tmp = it
        var runk = 0
        while (tmp >= 1){
            if (tmp % 2 == 1){
                bits[runk] += 1
            }
            runk += 1
            tmp /= 2
        }
        bits[runk] += tmp
    }
    l.forEach {
        var tmp = it
        var runk = 0
        for(i in 0 until 61){
            if (tmp % 2 == 0){
                a += bits[runk] * Math.pow(2.0,runk.toDouble()) % 1000000007
            }
            runk += 1
            tmp /= 2
        }
    }
    println(a.toInt())
}