fun main(args: Array<String>) {
    val MOD = 1000000007L
    val N = nextLong()
    val A = listOfLong()
    val C = Array<Long>(61) { 0L }
    for (a in A) {
        for (b in 0 until 61) {
            C[b] += (a shr b) % 2
        }
    }
    var ans = 0L
    fun shiftLeft(v: Long, shift: Int): Long {
        var ret = v % MOD
        for (s in 0 until shift) {
            ret *= 2
            ret %= MOD
        }
        return ret
    }
    for (b in 0 until 61) {
        ans += shiftLeft(C[b] * (N - C[b]), b)
        ans %= MOD
    }
    println(ans)
}
fun next() = readLine()!!
fun nextLong() = next().toLong()
fun listOfString() = next().split(" ")
fun listOfLong() = listOfString().map { java.lang.Long.parseLong(it) }