fun main(args: Array<String>) {
    val n = readLine()?.toInt() ?: return
    val a = readLine()?.split(" ")?.map(String::toLong) ?: return
    val mod = (1e9 + 7).toLong()

    var total = 0L
    for (b in 0..60) {
        val bn = 1L shl b
        val n0 = a.count { it and bn == 0L }.toLong()
        val n1 = n - n0
        total = (total + (bn % mod) * (n0 * n1 % mod)) %mod
    }
    println(total.toString())
}