fun main(args: Array<String>) {
    val MOD = 1000000007L
    val N = nextInt()
    val A = listOfLong()
    val C = Array<Long>(60) { 0L }
    A.forEach {
        for (j in 0 until 60) {
            C[j] += (it shr j) % 2
        }
    }
    var ans = 0L
    for (b in 0 until 60) {
        ans += C[b] * ((N - C[b]) shl b) % MOD
        ans %= MOD
    }
    println(ans)
}
fun next() = readLine()!!
fun nextInt(delta: Int = 0) = Integer.parseInt(next()) + delta
fun listOfString() = next().split(" ")
fun listOfLong(delta: Long = 0L) = listOfString().map { java.lang.Long.parseLong(it) + delta }