import java.io.PrintWriter

fun main() {
    PrintWriter(System.out).use { out ->
        solve(out)
        out.flush()
    }
}

fun solve(out: PrintWriter) {
    val n = readInteger()
    val aList = readLongList()

    var ans = 0L
    var e = 1L
    val MOD = 1000000007L
    for (i in 0 until 60) {
        val countOne = aList.count { ((it shr i) and 1) == 1L }
        val countZero = aList.size - countOne
        ans = (ans + (countOne % MOD) * (countZero % MOD) * e) % MOD
        e = (e * 2) % MOD
    }
    println(ans)
}

fun readInteger() = readLine()!!.toInt()
fun readLong() = readLine()!!.toLong()
fun readStringList() = readLine()!!.split(" ")
fun readIntegerList() = readStringList().map(String::toInt)
fun readLongList() = readStringList().map(String::toLong)
fun readDoubleList() = readStringList().map(String::toDouble)
