val MOD = 1000000007

fun main(args : Array<String>) {
    val n = readLine()!!.toInt()
    val aa = readLine()!!.split(" ").map { it.toLong() }

    var ans = 0L

    for (i in 0..60) {
        val bits = aa.map { (it shr i) and 1L }.sum()
        val sum = (bits * (n - bits) % MOD) * ((1L shl i) % MOD)
        ans += sum % MOD
        ans %= MOD
    }

    println(ans)
}